home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC / include / afxwin.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  157.0 KB  |  4,772 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11. #ifndef __AFXWIN_H__
  12. #ifndef RC_INVOKED
  13. #define __AFXWIN_H__
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // Make sure 'afx.h' is included first
  17.  
  18. #ifndef __AFX_H__
  19.     #include <afx.h>
  20. #endif
  21.  
  22. // Note: WINDOWS.H already included from AFXV_W32.H
  23.  
  24. #ifndef _INC_SHELLAPI
  25.     #include <shellapi.h>
  26. #endif
  27.  
  28. #ifndef __AFXRES_H__
  29.     #include <afxres.h>     // standard resource IDs
  30. #endif
  31.  
  32. #ifndef __AFXCOLL_H__
  33.     #include <afxcoll.h>    // standard collections
  34. #endif
  35.  
  36. #ifdef _AFX_MINREBUILD
  37. #pragma component(minrebuild, off)
  38. #endif
  39. #ifndef _AFX_FULLTYPEINFO
  40. #pragma component(mintypeinfo, on)
  41. #endif
  42.  
  43. #ifndef _AFX_NOFORCE_LIBS
  44. #pragma comment(lib, "uuid.lib")
  45. #endif
  46.  
  47. #ifdef _INC_WINDOWSX
  48. // The following names from WINDOWSX.H collide with names in this header
  49. #undef SubclassWindow
  50. #undef CopyRgn
  51. #endif
  52.  
  53. #ifdef _AFX_PACKING
  54. #pragma pack(push, _AFX_PACKING)
  55. #endif
  56.  
  57. /////////////////////////////////////////////////////////////////////////////
  58. // Classes declared in this file
  59.  
  60. class CSize;
  61. class CPoint;
  62. class CRect;
  63.  
  64. //CObject
  65.     //CException
  66.         //CSimpleException
  67.             class CResourceException;// Win resource failure exception
  68.             class CUserException;    // Message Box alert and stop operation
  69.  
  70.     class CGdiObject;            // CDC drawing tool
  71.         class CPen;              // a pen / HPEN wrapper
  72.         class CBrush;            // a brush / HBRUSH wrapper
  73.         class CFont;             // a font / HFONT wrapper
  74.         class CBitmap;           // a bitmap / HBITMAP wrapper
  75.         class CPalette;          // a palette / HPALLETE wrapper
  76.         class CRgn;              // a region / HRGN wrapper
  77.  
  78.     class CDC;                   // a Display Context / HDC wrapper
  79.         class CClientDC;         // CDC for client of window
  80.         class CWindowDC;         // CDC for entire window
  81.         class CPaintDC;          // embeddable BeginPaint struct helper
  82.  
  83.     class CMenu;                 // a menu / HMENU wrapper
  84.  
  85.     class CCmdTarget;            // a target for user commands
  86.         class CWnd;                 // a window / HWND wrapper
  87.             class CDialog;          // a dialog
  88.  
  89.             // standard windows controls
  90.             class CStatic;          // Static control
  91.             class CButton;          // Button control
  92.             class CListBox;         // ListBox control
  93.                 class CCheckListBox;// special listbox with checks
  94.             class CComboBox;        // ComboBox control
  95.             class CEdit;            // Edit control
  96.             class CScrollBar;       // ScrollBar control
  97.  
  98.             // frame windows
  99.             class CFrameWnd;        // standard SDI frame
  100.                 class CMDIFrameWnd; // standard MDI frame
  101.                 class CMDIChildWnd; // standard MDI child
  102.                 class CMiniFrameWnd;// half-height caption frame wnd
  103.  
  104.             // views on a document
  105.             class CView;            // a view on a document
  106.                 class CScrollView;  // a scrolling view
  107.  
  108.         class CWinThread;           // thread base class
  109.             class CWinApp;          // application base class
  110.  
  111.         class CDocTemplate;         // template for document creation
  112.             class CSingleDocTemplate;// SDI support
  113.             class CMultiDocTemplate; // MDI support
  114.  
  115.         class CDocument;            // main document abstraction
  116.  
  117.  
  118. // Helper classes
  119. class CCmdUI;           // Menu/button enabling
  120. class CDataExchange;    // Data exchange and validation context
  121. class CCommandLineInfo; // CommandLine parsing helper
  122. class CDocManager;      // CDocTemplate manager object
  123.  
  124. /////////////////////////////////////////////////////////////////////////////
  125.  
  126. // Type modifier for message handlers
  127. #ifndef afx_msg
  128. #define afx_msg         // intentional placeholder
  129. #endif
  130.  
  131. #undef AFX_DATA
  132. #define AFX_DATA AFX_CORE_DATA
  133.  
  134. /////////////////////////////////////////////////////////////////////////////
  135. // CSize - An extent, similar to Windows SIZE structure.
  136.  
  137. class CSize : public tagSIZE
  138. {
  139. public:
  140.  
  141. // Constructors
  142.     CSize();
  143.     CSize(int initCX, int initCY);
  144.     CSize(SIZE initSize);
  145.     CSize(POINT initPt);
  146.     CSize(DWORD dwSize);
  147.  
  148. // Operations
  149.     BOOL operator==(SIZE size) const;
  150.     BOOL operator!=(SIZE size) const;
  151.     void operator+=(SIZE size);
  152.     void operator-=(SIZE size);
  153.  
  154. // Operators returning CSize values
  155.     CSize operator+(SIZE size) const;
  156.     CSize operator-(SIZE size) const;
  157.     CSize operator-() const;
  158.  
  159. // Operators returning CPoint values
  160.     CPoint operator+(POINT point) const;
  161.     CPoint operator-(POINT point) const;
  162.  
  163. // Operators returning CRect values
  164.     CRect operator+(const RECT* lpRect) const;
  165.     CRect operator-(const RECT* lpRect) const;
  166. };
  167.  
  168. /////////////////////////////////////////////////////////////////////////////
  169. // CPoint - A 2-D point, similar to Windows POINT structure.
  170.  
  171. class CPoint : public tagPOINT
  172. {
  173. public:
  174.  
  175. // Constructors
  176.     CPoint();
  177.     CPoint(int initX, int initY);
  178.     CPoint(POINT initPt);
  179.     CPoint(SIZE initSize);
  180.     CPoint(DWORD dwPoint);
  181.  
  182. // Operations
  183.     void Offset(int xOffset, int yOffset);
  184.     void Offset(POINT point);
  185.     void Offset(SIZE size);
  186.     BOOL operator==(POINT point) const;
  187.     BOOL operator!=(POINT point) const;
  188.     void operator+=(SIZE size);
  189.     void operator-=(SIZE size);
  190.     void operator+=(POINT point);
  191.     void operator-=(POINT point);
  192.  
  193. // Operators returning CPoint values
  194.     CPoint operator+(SIZE size) const;
  195.     CPoint operator-(SIZE size) const;
  196.     CPoint operator-() const;
  197.     CPoint operator+(POINT point) const;
  198.  
  199. // Operators returning CSize values
  200.     CSize operator-(POINT point) const;
  201.  
  202. // Operators returning CRect values
  203.     CRect operator+(const RECT* lpRect) const;
  204.     CRect operator-(const RECT* lpRect) const;
  205. };
  206.  
  207. /////////////////////////////////////////////////////////////////////////////
  208. // CRect - A 2-D rectangle, similar to Windows RECT structure.
  209.  
  210. typedef const RECT* LPCRECT;    // pointer to read/only RECT
  211.  
  212. class CRect : public tagRECT
  213. {
  214. public:
  215.  
  216. // Constructors
  217.     CRect();
  218.     CRect(int l, int t, int r, int b);
  219.     CRect(const RECT& srcRect);
  220.     CRect(LPCRECT lpSrcRect);
  221.     CRect(POINT point, SIZE size);
  222.     CRect(POINT topLeft, POINT bottomRight);
  223.  
  224. // Attributes (in addition to RECT members)
  225.     int Width() const;
  226.     int Height() const;
  227.     CSize Size() const;
  228.     CPoint& TopLeft();
  229.     CPoint& BottomRight();
  230.     const CPoint& TopLeft() const;
  231.     const CPoint& BottomRight() const;
  232.     CPoint CenterPoint() const;
  233.     void SwapLeftRight();
  234.     static void SwapLeftRight(LPRECT lpRect);
  235.  
  236.     // convert between CRect and LPRECT/LPCRECT (no need for &)
  237.     operator LPRECT();
  238.     operator LPCRECT() const;
  239.  
  240.     BOOL IsRectEmpty() const;
  241.     BOOL IsRectNull() const;
  242.     BOOL PtInRect(POINT point) const;
  243.  
  244. // Operations
  245.     void SetRect(int x1, int y1, int x2, int y2);
  246.     void SetRect(POINT topLeft, POINT bottomRight);
  247.     void SetRectEmpty();
  248.     void CopyRect(LPCRECT lpSrcRect);
  249.     BOOL EqualRect(LPCRECT lpRect) const;
  250.  
  251.     void InflateRect(int x, int y);
  252.     void InflateRect(SIZE size);
  253.     void InflateRect(LPCRECT lpRect);
  254.     void InflateRect(int l, int t, int r, int b);
  255.     void DeflateRect(int x, int y);
  256.     void DeflateRect(SIZE size);
  257.     void DeflateRect(LPCRECT lpRect);
  258.     void DeflateRect(int l, int t, int r, int b);
  259.  
  260.     void OffsetRect(int x, int y);
  261.     void OffsetRect(SIZE size);
  262.     void OffsetRect(POINT point);
  263.     void NormalizeRect();
  264.  
  265.     // operations that fill '*this' with result
  266.     BOOL IntersectRect(LPCRECT lpRect1, LPCRECT lpRect2);
  267.     BOOL UnionRect(LPCRECT lpRect1, LPCRECT lpRect2);
  268.     BOOL SubtractRect(LPCRECT lpRectSrc1, LPCRECT lpRectSrc2);
  269.  
  270. // Additional Operations
  271.     void operator=(const RECT& srcRect);
  272.     BOOL operator==(const RECT& rect) const;
  273.     BOOL operator!=(const RECT& rect) const;
  274.     void operator+=(POINT point);
  275.     void operator+=(SIZE size);
  276.     void operator+=(LPCRECT lpRect);
  277.     void operator-=(POINT point);
  278.     void operator-=(SIZE size);
  279.     void operator-=(LPCRECT lpRect);
  280.     void operator&=(const RECT& rect);
  281.     void operator|=(const RECT& rect);
  282.  
  283. // Operators returning CRect values
  284.     CRect operator+(POINT point) const;
  285.     CRect operator-(POINT point) const;
  286.     CRect operator+(LPCRECT lpRect) const;
  287.     CRect operator+(SIZE size) const;
  288.     CRect operator-(SIZE size) const;
  289.     CRect operator-(LPCRECT lpRect) const;
  290.     CRect operator&(const RECT& rect2) const;
  291.     CRect operator|(const RECT& rect2) const;
  292.     CRect MulDiv(int nMultiplier, int nDivisor) const;
  293. };
  294.  
  295. #ifdef _DEBUG
  296. // Diagnostic Output
  297. CDumpContext& AFXAPI operator<<(CDumpContext& dc, SIZE size);
  298. CDumpContext& AFXAPI operator<<(CDumpContext& dc, POINT point);
  299. CDumpContext& AFXAPI operator<<(CDumpContext& dc, const RECT& rect);
  300. #endif //_DEBUG
  301.  
  302. // Serialization
  303. CArchive& AFXAPI operator<<(CArchive& ar, SIZE size);
  304. CArchive& AFXAPI operator<<(CArchive& ar, POINT point);
  305. CArchive& AFXAPI operator<<(CArchive& ar, const RECT& rect);
  306. CArchive& AFXAPI operator>>(CArchive& ar, SIZE& size);
  307. CArchive& AFXAPI operator>>(CArchive& ar, POINT& point);
  308. CArchive& AFXAPI operator>>(CArchive& ar, RECT& rect);
  309.  
  310. /////////////////////////////////////////////////////////////////////////////
  311. // Standard exceptions
  312.  
  313. class CResourceException : public CSimpleException    // resource failure
  314. {
  315.     DECLARE_DYNAMIC(CResourceException)
  316. public:
  317.     CResourceException();
  318.  
  319. // Implementation
  320. public:
  321.     CResourceException(BOOL bAutoDelete);
  322.     CResourceException(BOOL bAutoDelete, UINT nResourceID);
  323.     virtual ~CResourceException();
  324. };
  325.  
  326. class CUserException : public CSimpleException   // general user visible alert
  327. {
  328.     DECLARE_DYNAMIC(CUserException)
  329. public:
  330.     CUserException();
  331.  
  332. // Implementation
  333. public:
  334.     CUserException(BOOL bAutoDelete);
  335.     CUserException(BOOL bAutoDelete, UINT nResourceID);
  336.     virtual ~CUserException();
  337. };
  338.  
  339. void AFXAPI AfxThrowResourceException();
  340. void AFXAPI AfxThrowUserException();
  341.  
  342. /////////////////////////////////////////////////////////////////////////////
  343. // CGdiObject abstract class for CDC SelectObject
  344.  
  345. class CGdiObject : public CObject
  346. {
  347.     DECLARE_DYNCREATE(CGdiObject)
  348. public:
  349.  
  350. // Attributes
  351.     HGDIOBJ m_hObject;                  // must be first data member
  352.     operator HGDIOBJ() const;
  353.     HGDIOBJ GetSafeHandle() const;
  354.  
  355.     static CGdiObject* PASCAL FromHandle(HGDIOBJ hObject);
  356.     static void PASCAL DeleteTempMap();
  357.     BOOL Attach(HGDIOBJ hObject);
  358.     HGDIOBJ Detach();
  359.  
  360. // Constructors
  361.     CGdiObject(); // must Create a derived class object
  362.     BOOL DeleteObject();
  363.  
  364. // Operations
  365.     int GetObject(int nCount, LPVOID lpObject) const;
  366.     UINT GetObjectType() const;
  367.     BOOL CreateStockObject(int nIndex);
  368. WCE_DEL    BOOL UnrealizeObject();
  369.     BOOL operator==(const CGdiObject& obj) const;
  370.     BOOL operator!=(const CGdiObject& obj) const;
  371.  
  372. // Implementation
  373. public:
  374.     virtual ~CGdiObject();
  375. #ifdef _DEBUG
  376.     virtual void Dump(CDumpContext& dc) const;
  377.     virtual void AssertValid() const;
  378. #endif
  379. };
  380.  
  381. /////////////////////////////////////////////////////////////////////////////
  382. // CGdiObject subclasses (drawing tools)
  383.  
  384. class CPen : public CGdiObject
  385. {
  386.     DECLARE_DYNAMIC(CPen)
  387.  
  388. public:
  389.     static CPen* PASCAL FromHandle(HPEN hPen);
  390.  
  391. // Constructors
  392.     CPen();
  393.     CPen(int nPenStyle, int nWidth, COLORREF crColor);
  394. WCE_DEL    CPen(int nPenStyle, int nWidth, const LOGBRUSH* pLogBrush, 
  395. WCE_DEL        int nStyleCount = 0, const DWORD* lpStyle = NULL);
  396.     BOOL CreatePen(int nPenStyle, int nWidth, COLORREF crColor);
  397. WCE_DEL    BOOL CreatePen(int nPenStyle, int nWidth, const LOGBRUSH* pLogBrush, 
  398. WCE_DEL        int nStyleCount = 0, const DWORD* lpStyle = NULL);
  399.     BOOL CreatePenIndirect(LPLOGPEN lpLogPen);
  400.  
  401. // Attributes
  402.     operator HPEN() const;
  403.     int GetLogPen(LOGPEN* pLogPen);
  404. WCE_DEL    int GetExtLogPen(EXTLOGPEN* pLogPen);
  405.  
  406. // Implementation
  407. public:
  408.     virtual ~CPen();
  409. #ifdef _DEBUG
  410.     virtual void Dump(CDumpContext& dc) const;
  411. #endif
  412. };
  413.  
  414. class CBrush : public CGdiObject
  415. {
  416.     DECLARE_DYNAMIC(CBrush)
  417.  
  418. public:
  419.     static CBrush* PASCAL FromHandle(HBRUSH hBrush);
  420.  
  421. // Constructors
  422.     CBrush();
  423.     CBrush(COLORREF crColor);             // CreateSolidBrush
  424. WCE_DEL    CBrush(int nIndex, COLORREF crColor); // CreateHatchBrush
  425.     CBrush(CBitmap* pBitmap);          // CreatePatternBrush
  426.  
  427.     BOOL CreateSolidBrush(COLORREF crColor);
  428. WCE_DEL    BOOL CreateHatchBrush(int nIndex, COLORREF crColor);
  429.     BOOL CreateBrushIndirect(const LOGBRUSH* lpLogBrush);
  430.     BOOL CreatePatternBrush(CBitmap* pBitmap);
  431.     BOOL CreateDIBPatternBrush(HGLOBAL hPackedDIB, UINT nUsage);
  432.     BOOL CreateDIBPatternBrush(const void* lpPackedDIB, UINT nUsage);
  433.     BOOL CreateSysColorBrush(int nIndex);
  434.  
  435. // Attributes
  436.     operator HBRUSH() const;
  437.     int GetLogBrush(LOGBRUSH* pLogBrush);
  438.  
  439. // Implementation
  440. public:
  441.     virtual ~CBrush();
  442. #ifdef _DEBUG
  443.     virtual void Dump(CDumpContext& dc) const;
  444. #endif
  445. };
  446.  
  447. class CFont : public CGdiObject
  448. {
  449.     DECLARE_DYNAMIC(CFont)
  450.  
  451. public:
  452.     static CFont* PASCAL FromHandle(HFONT hFont);
  453.  
  454. // Constructors
  455.     CFont();
  456.     BOOL CreateFontIndirect(const LOGFONT* lpLogFont);
  457.     BOOL CreateFont(int nHeight, int nWidth, int nEscapement,
  458.             int nOrientation, int nWeight, BYTE bItalic, BYTE bUnderline,
  459.             BYTE cStrikeOut, BYTE nCharSet, BYTE nOutPrecision,
  460.             BYTE nClipPrecision, BYTE nQuality, BYTE nPitchAndFamily,
  461.             LPCTSTR lpszFacename);
  462.     BOOL CreatePointFont(int nPointSize, LPCTSTR lpszFaceName, CDC* pDC = NULL);
  463.     BOOL CreatePointFontIndirect(const LOGFONT* lpLogFont, CDC* pDC = NULL);
  464.  
  465. // Attributes
  466.     operator HFONT() const;
  467.     int GetLogFont(LOGFONT* pLogFont);
  468.  
  469. // Implementation
  470. public:
  471.     virtual ~CFont();
  472. #ifdef _DEBUG
  473.     virtual void Dump(CDumpContext& dc) const;
  474. #endif
  475. };
  476.  
  477. class CBitmap : public CGdiObject
  478. {
  479.     DECLARE_DYNAMIC(CBitmap)
  480.  
  481. public:
  482.     static CBitmap* PASCAL FromHandle(HBITMAP hBitmap);
  483.  
  484. // Constructors
  485.     CBitmap();
  486.  
  487.     BOOL LoadBitmap(LPCTSTR lpszResourceName);
  488.     BOOL LoadBitmap(UINT nIDResource);
  489.     BOOL LoadOEMBitmap(UINT nIDBitmap); // for OBM_/OCR_/OIC_
  490. WCE_DEL    BOOL LoadMappedBitmap(UINT nIDBitmap, UINT nFlags = 0, 
  491. WCE_DEL        LPCOLORMAP lpColorMap = NULL, int nMapSize = 0);
  492.     BOOL CreateBitmap(int nWidth, int nHeight, UINT nPlanes, UINT nBitcount,
  493.             const void* lpBits);
  494.     BOOL CreateBitmapIndirect(LPBITMAP lpBitmap);
  495.     BOOL CreateCompatibleBitmap(CDC* pDC, int nWidth, int nHeight);
  496. WCE_DEL    BOOL CreateDiscardableBitmap(CDC* pDC, int nWidth, int nHeight);
  497.  
  498. // Attributes
  499.     operator HBITMAP() const;
  500.     int GetBitmap(BITMAP* pBitMap);
  501.  
  502. // Operations
  503. WCE_DEL    DWORD SetBitmapBits(DWORD dwCount, const void* lpBits);
  504. WCE_DEL    DWORD GetBitmapBits(DWORD dwCount, LPVOID lpBits) const;
  505.     CSize SetBitmapDimension(int nWidth, int nHeight);
  506.     CSize GetBitmapDimension() const;
  507.  
  508. // Implementation
  509. public:
  510.     virtual ~CBitmap();
  511. #ifdef _DEBUG
  512.     virtual void Dump(CDumpContext& dc) const;
  513. #endif
  514. WCE_INS protected: CSize m_sizeDim;
  515. };
  516.  
  517. class CPalette : public CGdiObject
  518. {
  519.     DECLARE_DYNAMIC(CPalette)
  520.  
  521. public:
  522.     static CPalette* PASCAL FromHandle(HPALETTE hPalette);
  523.  
  524. // Constructors
  525.     CPalette();
  526.     BOOL CreatePalette(LPLOGPALETTE lpLogPalette);
  527. WCE_DEL    BOOL CreateHalftonePalette(CDC* pDC);
  528.  
  529. // Attributes
  530.     operator HPALETTE() const;
  531.     int GetEntryCount();
  532.     UINT GetPaletteEntries(UINT nStartIndex, UINT nNumEntries,
  533.             LPPALETTEENTRY lpPaletteColors) const;
  534.     UINT SetPaletteEntries(UINT nStartIndex, UINT nNumEntries,
  535.             LPPALETTEENTRY lpPaletteColors);
  536.  
  537. // Operations
  538. WCE_DEL    void AnimatePalette(UINT nStartIndex, UINT nNumEntries, 
  539. WCE_DEL            LPPALETTEENTRY lpPaletteColors);
  540.     UINT GetNearestPaletteIndex(COLORREF crColor) const;
  541. WCE_DEL    BOOL ResizePalette(UINT nNumEntries);
  542.  
  543. // Implementation
  544.     virtual ~CPalette();
  545. };
  546.  
  547. class CRgn : public CGdiObject
  548. {
  549.     DECLARE_DYNAMIC(CRgn)
  550.  
  551. public:
  552.     static CRgn* PASCAL FromHandle(HRGN hRgn);
  553.     operator HRGN() const;
  554.  
  555. // Constructors
  556.     CRgn();
  557.     BOOL CreateRectRgn(int x1, int y1, int x2, int y2);
  558.     BOOL CreateRectRgnIndirect(LPCRECT lpRect);
  559. WCE_DEL    BOOL CreateEllipticRgn(int x1, int y1, int x2, int y2);
  560. WCE_DEL    BOOL CreateEllipticRgnIndirect(LPCRECT lpRect);
  561. WCE_DEL    BOOL CreatePolygonRgn(LPPOINT lpPoints, int nCount, int nMode);
  562. WCE_DEL    BOOL CreatePolyPolygonRgn(LPPOINT lpPoints, LPINT lpPolyCounts, 
  563. WCE_DEL            int nCount, int nPolyFillMode);
  564. WCE_DEL    BOOL CreateRoundRectRgn(int x1, int y1, int x2, int y2, int x3, int y3);
  565. WCE_DEL    BOOL CreateFromPath(CDC* pDC);
  566. WCE_DEL    BOOL CreateFromData(const XFORM* lpXForm, int nCount, 
  567. WCE_DEL            const RGNDATA* pRgnData);
  568.  
  569. // Operations
  570.     void SetRectRgn(int x1, int y1, int x2, int y2);
  571.     void SetRectRgn(LPCRECT lpRect);
  572.     int CombineRgn(CRgn* pRgn1, CRgn* pRgn2, int nCombineMode);
  573.     int CopyRgn(CRgn* pRgnSrc);
  574.     BOOL EqualRgn(CRgn* pRgn) const;
  575.     int OffsetRgn(int x, int y);
  576.     int OffsetRgn(POINT point);
  577.     int GetRgnBox(LPRECT lpRect) const;
  578.     BOOL PtInRegion(int x, int y) const;
  579.     BOOL PtInRegion(POINT point) const;
  580.     BOOL RectInRegion(LPCRECT lpRect) const;
  581.     int GetRegionData(LPRGNDATA lpRgnData, int nCount) const;
  582.  
  583. // Implementation
  584.     virtual ~CRgn();
  585. };
  586.  
  587. /////////////////////////////////////////////////////////////////////////////
  588. // The device context
  589.  
  590. class CDC : public CObject
  591. {
  592.     DECLARE_DYNCREATE(CDC)
  593. public:
  594.  
  595. // Attributes
  596.     HDC m_hDC;          // The output DC (must be first data member)
  597.     HDC m_hAttribDC;    // The Attribute DC
  598.     operator HDC() const;
  599.     HDC GetSafeHdc() const; // Always returns the Output DC
  600. WCE_DEL    CWnd* GetWindow() const;
  601.  
  602.     static CDC* PASCAL FromHandle(HDC hDC);
  603.     static void PASCAL DeleteTempMap();
  604.     BOOL Attach(HDC hDC);   // Attach/Detach affects only the Output DC
  605.     HDC Detach();
  606.  
  607.     virtual void SetAttribDC(HDC hDC);  // Set the Attribute DC
  608.     virtual void SetOutputDC(HDC hDC);  // Set the Output DC
  609.     virtual void ReleaseAttribDC();     // Release the Attribute DC
  610.     virtual void ReleaseOutputDC();     // Release the Output DC
  611.     BOOL IsPrinting() const;            // TRUE if being used for printing
  612.  
  613.     CPen* GetCurrentPen() const;
  614.     CBrush* GetCurrentBrush() const;
  615. WCE_DEL    CPalette* GetCurrentPalette() const;
  616.     CFont* GetCurrentFont() const;
  617.     CBitmap* GetCurrentBitmap() const;
  618.  
  619.     // for bidi and mirrored localization
  620.     DWORD GetLayout() const;
  621.     DWORD SetLayout(DWORD dwLayout);
  622.  
  623. // Constructors
  624.     CDC();
  625.     BOOL CreateDC(LPCTSTR lpszDriverName, LPCTSTR lpszDeviceName,
  626.         LPCTSTR lpszOutput, const void* lpInitData);
  627. WCE_DEL    BOOL CreateIC(LPCTSTR lpszDriverName, LPCTSTR lpszDeviceName, 
  628. WCE_DEL        LPCTSTR lpszOutput, const void* lpInitData);
  629.     BOOL CreateCompatibleDC(CDC* pDC);
  630.  
  631.     BOOL DeleteDC();
  632.  
  633. // Device-Context Functions
  634.     virtual int SaveDC();
  635.     virtual BOOL RestoreDC(int nSavedDC);
  636.     int GetDeviceCaps(int nIndex) const;
  637. WCE_DEL    UINT SetBoundsRect(LPCRECT lpRectBounds, UINT flags);
  638. WCE_DEL    UINT GetBoundsRect(LPRECT lpRectBounds, UINT flags);
  639. WCE_DEL    BOOL ResetDC(const DEVMODE* lpDevMode);
  640.  
  641. // Drawing-Tool Functions
  642.     CPoint GetBrushOrg() const;
  643.     CPoint SetBrushOrg(int x, int y);
  644.     CPoint SetBrushOrg(POINT point);
  645. WCE_DEL    int EnumObjects(int nObjectType, 
  646. WCE_DEL            int (CALLBACK* lpfn)(LPVOID, LPARAM), LPARAM lpData);
  647.  
  648. // Type-safe selection helpers
  649. public:
  650.     virtual CGdiObject* SelectStockObject(int nIndex);
  651.     CPen* SelectObject(CPen* pPen);
  652.     CBrush* SelectObject(CBrush* pBrush);
  653.     virtual CFont* SelectObject(CFont* pFont);
  654.     CBitmap* SelectObject(CBitmap* pBitmap);
  655.     int SelectObject(CRgn* pRgn);       // special return for regions
  656.     CGdiObject* SelectObject(CGdiObject* pObject);
  657.         // CGdiObject* provided so compiler doesn't use SelectObject(HGDIOBJ)
  658.  
  659. // Color and Color Palette Functions
  660.     COLORREF GetNearestColor(COLORREF crColor) const;
  661.     CPalette* SelectPalette(CPalette* pPalette, BOOL bForceBackground);
  662.     UINT RealizePalette();
  663. WCE_DEL void UpdateColors();
  664.  
  665. // Drawing-Attribute Functions
  666.     COLORREF GetBkColor() const;
  667.     int GetBkMode() const;
  668. WCE_DEL    int GetPolyFillMode() const;
  669. WCE_DEL    int GetROP2() const;
  670. WCE_DEL    int GetStretchBltMode() const;
  671.     COLORREF GetTextColor() const;
  672.  
  673.     virtual COLORREF SetBkColor(COLORREF crColor);
  674.     int SetBkMode(int nBkMode);
  675. WCE_DEL    int SetPolyFillMode(int nPolyFillMode);
  676.     int SetROP2(int nDrawMode);
  677. WCE_DEL    int SetStretchBltMode(int nStretchMode);
  678.  
  679.     virtual COLORREF SetTextColor(COLORREF crColor);
  680.  
  681. WCE_DEL    BOOL GetColorAdjustment(LPCOLORADJUSTMENT lpColorAdjust) const;
  682. WCE_DEL    BOOL SetColorAdjustment(const COLORADJUSTMENT* lpColorAdjust);
  683.  
  684. // Mapping Functions
  685.     int GetMapMode() const;
  686.     CPoint GetViewportOrg() const;
  687. WCE_DEL    virtual int SetMapMode(int nMapMode);
  688.     // Viewport Origin
  689. WCE_DEL    virtual CPoint SetViewportOrg(int x, int y);
  690. WCE_DEL            CPoint SetViewportOrg(POINT point);
  691. WCE_DEL    virtual CPoint OffsetViewportOrg(int nWidth, int nHeight);
  692.  
  693.     // Viewport Extent
  694.     CSize GetViewportExt() const;
  695. WCE_DEL    virtual CSize SetViewportExt(int cx, int cy);
  696. WCE_DEL            CSize SetViewportExt(SIZE size);
  697. WCE_DEL    virtual CSize ScaleViewportExt(int xNum, int xDenom, int yNum, int yDenom);
  698.  
  699.     // Window Origin
  700.     CPoint GetWindowOrg() const;
  701. WCE_DEL    CPoint SetWindowOrg(int x, int y);
  702. WCE_DEL    CPoint SetWindowOrg(POINT point);
  703. WCE_DEL    CPoint OffsetWindowOrg(int nWidth, int nHeight);
  704.  
  705.     // Window extent
  706.     CSize GetWindowExt() const;
  707. WCE_DEL    virtual CSize SetWindowExt(int cx, int cy);
  708. WCE_DEL            CSize SetWindowExt(SIZE size);
  709. WCE_DEL    virtual CSize ScaleWindowExt(int xNum, int xDenom, int yNum, int yDenom);
  710.  
  711. // Coordinate Functions
  712.     void DPtoLP(LPPOINT lpPoints, int nCount = 1) const;
  713.     void DPtoLP(LPRECT lpRect) const;
  714.     void DPtoLP(LPSIZE lpSize) const;
  715.     void LPtoDP(LPPOINT lpPoints, int nCount = 1) const;
  716.     void LPtoDP(LPRECT lpRect) const;
  717.     void LPtoDP(LPSIZE lpSize) const;
  718.  
  719. // Special Coordinate Functions (useful for dealing with metafiles and OLE)
  720.     void DPtoHIMETRIC(LPSIZE lpSize) const;
  721.     void LPtoHIMETRIC(LPSIZE lpSize) const;
  722.     void HIMETRICtoDP(LPSIZE lpSize) const;
  723.     void HIMETRICtoLP(LPSIZE lpSize) const;
  724.  
  725. // Region Functions
  726.     BOOL FillRgn(CRgn* pRgn, CBrush* pBrush);
  727. WCE_DEL    BOOL FrameRgn(CRgn* pRgn, CBrush* pBrush, int nWidth, int nHeight);
  728. WCE_DEL    BOOL InvertRgn(CRgn* pRgn);
  729. WCE_DEL    BOOL PaintRgn(CRgn* pRgn);
  730.  
  731. // Clipping Functions
  732.     virtual int GetClipBox(LPRECT lpRect) const;
  733. WCE_DEL    virtual BOOL PtVisible(int x, int y) const;
  734. WCE_DEL            BOOL PtVisible(POINT point) const;
  735.     virtual BOOL RectVisible(LPCRECT lpRect) const;
  736.             int SelectClipRgn(CRgn* pRgn);
  737.             int ExcludeClipRect(int x1, int y1, int x2, int y2);
  738.             int ExcludeClipRect(LPCRECT lpRect);
  739.             int ExcludeUpdateRgn(CWnd* pWnd);
  740.             int IntersectClipRect(int x1, int y1, int x2, int y2);
  741.             int IntersectClipRect(LPCRECT lpRect);
  742.             int OffsetClipRgn(int x, int y);
  743.             int OffsetClipRgn(SIZE size);
  744.     int SelectClipRgn(CRgn* pRgn, int nMode);
  745.  
  746. // Line-Output Functions
  747.     CPoint GetCurrentPosition() const;
  748.     CPoint MoveTo(int x, int y);
  749.     CPoint MoveTo(POINT point);
  750.     BOOL LineTo(int x, int y);
  751.     BOOL LineTo(POINT point);
  752. WCE_DEL    BOOL Arc(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
  753. WCE_DEL    BOOL Arc(LPCRECT lpRect, POINT ptStart, POINT ptEnd);
  754.     BOOL Polyline(LPPOINT lpPoints, int nCount);
  755.  
  756. WCE_DEL    BOOL AngleArc(int x, int y, int nRadius, float fStartAngle, float fSweepAngle);
  757. WCE_DEL    BOOL ArcTo(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
  758. WCE_DEL    BOOL ArcTo(LPCRECT lpRect, POINT ptStart, POINT ptEnd);
  759. WCE_DEL    int GetArcDirection() const;
  760. WCE_DEL    int SetArcDirection(int nArcDirection);
  761.  
  762. WCE_DEL    BOOL PolyDraw(const POINT* lpPoints, const BYTE* lpTypes, int nCount);
  763.     BOOL PolylineTo(const POINT* lpPoints, int nCount);
  764.     BOOL PolyPolyline(const POINT* lpPoints,
  765.         const DWORD* lpPolyPoints, int nCount);
  766.  
  767. WCE_DEL    BOOL PolyBezier(const POINT* lpPoints, int nCount);
  768. WCE_DEL    BOOL PolyBezierTo(const POINT* lpPoints, int nCount);
  769.  
  770. // Simple Drawing Functions
  771.     void FillRect(LPCRECT lpRect, CBrush* pBrush);
  772.     void FrameRect(LPCRECT lpRect, CBrush* pBrush);
  773.     void InvertRect(LPCRECT lpRect);
  774.     BOOL DrawIcon(int x, int y, HICON hIcon);
  775.     BOOL DrawIcon(POINT point, HICON hIcon);
  776. #if (WINVER >= 0x400)
  777. WCE_DEL    BOOL DrawState(CPoint pt, CSize size, HBITMAP hBitmap, UINT nFlags, 
  778. WCE_DEL        HBRUSH hBrush = NULL);
  779. WCE_DEL    BOOL DrawState(CPoint pt, CSize size, CBitmap* pBitmap, UINT nFlags, 
  780. WCE_DEL        CBrush* pBrush = NULL);
  781. WCE_DEL    BOOL DrawState(CPoint pt, CSize size, HICON hIcon, UINT nFlags, 
  782. WCE_DEL        HBRUSH hBrush = NULL);
  783. WCE_DEL    BOOL DrawState(CPoint pt, CSize size, HICON hIcon, UINT nFlags, 
  784. WCE_DEL        CBrush* pBrush = NULL);
  785. WCE_DEL    BOOL DrawState(CPoint pt, CSize size, LPCTSTR lpszText, UINT nFlags, 
  786. WCE_DEL        BOOL bPrefixText = TRUE, int nTextLen = 0, HBRUSH hBrush = NULL);
  787. WCE_DEL    BOOL DrawState(CPoint pt, CSize size, LPCTSTR lpszText, UINT nFlags, 
  788. WCE_DEL        BOOL bPrefixText = TRUE, int nTextLen = 0, CBrush* pBrush = NULL);
  789. WCE_DEL    BOOL DrawState(CPoint pt, CSize size, DRAWSTATEPROC lpDrawProc, 
  790. WCE_DEL        LPARAM lData, UINT nFlags, HBRUSH hBrush = NULL);
  791. WCE_DEL    BOOL DrawState(CPoint pt, CSize size, DRAWSTATEPROC lpDrawProc, 
  792. WCE_DEL        LPARAM lData, UINT nFlags, CBrush* pBrush = NULL);
  793. #endif
  794.  
  795. // Ellipse and Polygon Functions
  796. WCE_DEL    BOOL Chord(int x1, int y1, int x2, int y2, int x3, int y3, 
  797. WCE_DEL        int x4, int y4);
  798. WCE_DEL    BOOL Chord(LPCRECT lpRect, POINT ptStart, POINT ptEnd);
  799.     void DrawFocusRect(LPCRECT lpRect);
  800.     BOOL Ellipse(int x1, int y1, int x2, int y2);
  801.     BOOL Ellipse(LPCRECT lpRect);
  802. WCE_DEL    BOOL Pie(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
  803. WCE_DEL    BOOL Pie(LPCRECT lpRect, POINT ptStart, POINT ptEnd);
  804.     BOOL Polygon(LPPOINT lpPoints, int nCount);
  805.     BOOL PolyPolygon(LPPOINT lpPoints, LPINT lpPolyCounts, int nCount);
  806.     BOOL Rectangle(int x1, int y1, int x2, int y2);
  807.     BOOL Rectangle(LPCRECT lpRect);
  808.     BOOL RoundRect(int x1, int y1, int x2, int y2, int x3, int y3);
  809.     BOOL RoundRect(LPCRECT lpRect, POINT point);
  810.  
  811. // Bitmap Functions
  812.     BOOL PatBlt(int x, int y, int nWidth, int nHeight, DWORD dwRop);
  813.     BOOL BitBlt(int x, int y, int nWidth, int nHeight, CDC* pSrcDC,
  814.         int xSrc, int ySrc, DWORD dwRop);
  815.     BOOL StretchBlt(int x, int y, int nWidth, int nHeight, CDC* pSrcDC,
  816.         int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, DWORD dwRop);
  817.     COLORREF GetPixel(int x, int y) const;
  818.     COLORREF GetPixel(POINT point) const;
  819.     COLORREF SetPixel(int x, int y, COLORREF crColor);
  820.     COLORREF SetPixel(POINT point, COLORREF crColor);
  821. WCE_DEL    BOOL FloodFill(int x, int y, COLORREF crColor);
  822. WCE_DEL    BOOL ExtFloodFill(int x, int y, COLORREF crColor, UINT nFillType);
  823.     BOOL MaskBlt(int x, int y, int nWidth, int nHeight, CDC* pSrcDC,
  824.         int xSrc, int ySrc, CBitmap& maskBitmap, int xMask, int yMask,
  825.         DWORD dwRop);
  826. WCE_DEL    BOOL PlgBlt(LPPOINT lpPoint, CDC* pSrcDC, int xSrc, int ySrc, 
  827. WCE_DEL        int nWidth, int nHeight, CBitmap& maskBitmap, int xMask, int yMask);
  828. WCE_DEL    BOOL SetPixelV(int x, int y, COLORREF crColor);
  829. WCE_DEL    BOOL SetPixelV(POINT point, COLORREF crColor);
  830.  
  831. // Text Functions
  832. WCE_DEL    virtual BOOL TextOut(int x, int y, LPCTSTR lpszString, int nCount);
  833. WCE_DEL            BOOL TextOut(int x, int y, const CString& str);
  834.     virtual BOOL ExtTextOut(int x, int y, UINT nOptions, LPCRECT lpRect,
  835.                 LPCTSTR lpszString, UINT nCount, LPINT lpDxWidths);
  836.             BOOL ExtTextOut(int x, int y, UINT nOptions, LPCRECT lpRect,
  837.                 const CString& str, LPINT lpDxWidths);
  838. WCE_DEL    virtual CSize TabbedTextOut(int x, int y, LPCTSTR lpszString, int nCount, 
  839. WCE_DEL                int nTabPositions, LPINT lpnTabStopPositions, int nTabOrigin);
  840. WCE_DEL            CSize TabbedTextOut(int x, int y, const CString& str, 
  841. WCE_DEL                int nTabPositions, LPINT lpnTabStopPositions, int nTabOrigin);
  842.     virtual int DrawText(LPCTSTR lpszString, int nCount, LPRECT lpRect,
  843.                 UINT nFormat);
  844.             int DrawText(const CString& str, LPRECT lpRect, UINT nFormat);
  845.     CSize GetTextExtent(LPCTSTR lpszString, int nCount) const;
  846.     CSize GetTextExtent(const CString& str) const;
  847.     CSize GetOutputTextExtent(LPCTSTR lpszString, int nCount) const;
  848.     CSize GetOutputTextExtent(const CString& str) const;
  849. WCE_DEL    CSize GetTabbedTextExtent(LPCTSTR lpszString, int nCount, 
  850. WCE_DEL        int nTabPositions, LPINT lpnTabStopPositions) const;
  851. WCE_DEL    CSize GetTabbedTextExtent(const CString& str, int nTabPositions, 
  852. WCE_DEL        LPINT lpnTabStopPositions) const;
  853. WCE_DEL    CSize GetOutputTabbedTextExtent(LPCTSTR lpszString, int nCount, 
  854. WCE_DEL        int nTabPositions, LPINT lpnTabStopPositions) const;
  855. WCE_DEL    CSize GetOutputTabbedTextExtent(const CString& str, 
  856. WCE_DEL        int nTabPositions, LPINT lpnTabStopPositions) const;
  857. WCE_DEL    virtual BOOL GrayString(CBrush* pBrush, 
  858. WCE_DEL        BOOL (CALLBACK* lpfnOutput)(HDC, LPARAM, int), LPARAM lpData, 
  859. WCE_DEL            int nCount, int x, int y, int nWidth, int nHeight);
  860. WCE_DEL    UINT GetTextAlign() const;
  861. WCE_DEL    UINT SetTextAlign(UINT nFlags);
  862.         int GetTextFace(int nCount, LPTSTR lpszFacename) const;
  863.         int GetTextFace(CString& rString) const;
  864.         BOOL GetTextMetrics(LPTEXTMETRIC lpMetrics) const;
  865.         BOOL GetOutputTextMetrics(LPTEXTMETRIC lpMetrics) const;
  866. WCE_DEL    int SetTextJustification(int nBreakExtra, int nBreakCount);
  867. WCE_DEL    int GetTextCharacterExtra() const;
  868. WCE_DEL    int SetTextCharacterExtra(int nCharExtra);
  869.  
  870. // Advanced Drawing
  871. #if (WINVER >= 0x400)
  872.     BOOL DrawEdge(LPRECT lpRect, UINT nEdge, UINT nFlags);
  873.     BOOL DrawFrameControl(LPRECT lpRect, UINT nType, UINT nState);
  874. #endif
  875.  
  876. // Scrolling Functions
  877. BOOL ScrollDC(int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip,
  878.     CRgn* pRgnUpdate, LPRECT lpRectUpdate);
  879.  
  880. // Font Functions
  881. WCE_DEL    BOOL GetCharWidth(UINT nFirstChar, UINT nLastChar, LPINT lpBuffer) const;
  882. WCE_DEL    BOOL GetOutputCharWidth(UINT nFirstChar, UINT nLastChar, LPINT lpBuffer) const;
  883. WCE_DEL    DWORD SetMapperFlags(DWORD dwFlag);
  884. WCE_DEL    CSize GetAspectRatioFilter() const;
  885.  
  886. WCE_DEL    BOOL GetCharABCWidths(UINT nFirstChar, UINT nLastChar, LPABC lpabc) const;
  887. WCE_DEL    DWORD GetFontData(DWORD dwTable, DWORD dwOffset, LPVOID lpData, DWORD cbData) const;
  888. WCE_DEL    int GetKerningPairs(int nPairs, LPKERNINGPAIR lpkrnpair) const;
  889. WCE_DEL    UINT GetOutlineTextMetrics(UINT cbData, LPOUTLINETEXTMETRIC lpotm) const;
  890. WCE_DEL    DWORD GetGlyphOutline(UINT nChar, UINT nFormat, LPGLYPHMETRICS lpgm, 
  891. WCE_DEL        DWORD cbBuffer, LPVOID lpBuffer, const MAT2* lpmat2) const;
  892.  
  893. WCE_DEL    BOOL GetCharABCWidths(UINT nFirstChar, UINT nLastChar, 
  894. WCE_DEL        LPABCFLOAT lpABCF) const;
  895. WCE_DEL    BOOL GetCharWidth(UINT nFirstChar, UINT nLastChar, 
  896. WCE_DEL        float* lpFloatBuffer) const;
  897.  
  898. // Printer/Device Escape Functions
  899. WCE_DEL    virtual int Escape(int nEscape, int nCount, 
  900. WCE_DEL        LPCSTR lpszInData, LPVOID lpOutData);
  901. WCE_DEL    int Escape(int nEscape, int nInputSize, LPCSTR lpszInputData,
  902. WCE_DEL        int nOutputSize, LPSTR lpszOutputData);
  903. WCE_DEL    int DrawEscape(int nEscape, int nInputSize, LPCSTR lpszInputData);
  904.  
  905. #if !defined(_WIN32_WCE_NO_PRINTING)
  906.     // Escape helpers
  907.     int StartDoc(LPCTSTR lpszDocName);  // old Win3.0 version
  908.     int StartDoc(LPDOCINFO lpDocInfo);
  909.     int StartPage();
  910.     int EndPage();
  911.     int SetAbortProc(BOOL (CALLBACK* lpfn)(HDC, int));
  912.     int AbortDoc();
  913.     int EndDoc();
  914. #endif // _WIN32_WCE_NO_PRINTING
  915.  
  916. // MetaFile Functions
  917. WCE_DEL    BOOL PlayMetaFile(HMETAFILE hMF);
  918. WCE_DEL    BOOL PlayMetaFile(HENHMETAFILE hEnhMetaFile, LPCRECT lpBounds);
  919. WCE_DEL    BOOL AddMetaFileComment(UINT nDataSize, const BYTE* pCommentData);
  920.         // can be used for enhanced metafiles only
  921.  
  922. // Path Functions
  923. WCE_DEL    BOOL AbortPath();
  924. WCE_DEL    BOOL BeginPath();
  925. WCE_DEL    BOOL CloseFigure();
  926. WCE_DEL    BOOL EndPath();
  927. WCE_DEL    BOOL FillPath();
  928. WCE_DEL    BOOL FlattenPath();
  929. WCE_DEL    BOOL StrokeAndFillPath();
  930. WCE_DEL    BOOL StrokePath();
  931. WCE_DEL    BOOL WidenPath();
  932. WCE_DEL    float GetMiterLimit() const;
  933. WCE_DEL    BOOL SetMiterLimit(float fMiterLimit);
  934. WCE_DEL    int GetPath(LPPOINT lpPoints, LPBYTE lpTypes, int nCount) const;
  935. WCE_DEL    BOOL SelectClipPath(int nMode);
  936.  
  937. // Misc Helper Functions
  938.     static CBrush* PASCAL GetHalftoneBrush();
  939.     void DrawDragRect(LPCRECT lpRect, SIZE size,
  940.         LPCRECT lpRectLast, SIZE sizeLast,
  941.         CBrush* pBrush = NULL, CBrush* pBrushLast = NULL);
  942.     void FillSolidRect(LPCRECT lpRect, COLORREF clr);
  943.     void FillSolidRect(int x, int y, int cx, int cy, COLORREF clr);
  944.     void Draw3dRect(LPCRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottomRight);
  945.     void Draw3dRect(int x, int y, int cx, int cy,
  946.         COLORREF clrTopLeft, COLORREF clrBottomRight);
  947.  
  948. // Implementation
  949. public:
  950.     virtual ~CDC();
  951. #ifdef _DEBUG
  952.     virtual void AssertValid() const;
  953.     virtual void Dump(CDumpContext& dc) const;
  954. #endif
  955.  
  956.     // advanced use and implementation
  957. #if !defined(_WIN32_WCE_NO_PRINTING)
  958.     BOOL m_bPrinting;
  959. #endif // _WIN32_WCE_NO_PRINTING
  960.     HGDIOBJ SelectObject(HGDIOBJ);      // do not use for regions
  961.  
  962. protected:
  963.     // used for implementation of non-virtual SelectObject calls
  964.     static CGdiObject* PASCAL SelectGdiObject(HDC hDC, HGDIOBJ h);
  965. WCE_INS    CPoint m_ptCurPos;  
  966. };
  967.  
  968. /////////////////////////////////////////////////////////////////////////////
  969. // CDC Helpers
  970.  
  971. class CPaintDC : public CDC
  972. {
  973.     DECLARE_DYNAMIC(CPaintDC)
  974.  
  975. // Constructors
  976. public:
  977.     CPaintDC(CWnd* pWnd);   // BeginPaint
  978.  
  979. // Attributes
  980. protected:
  981.     HWND m_hWnd;
  982. public:
  983.     PAINTSTRUCT m_ps;       // actual paint struct!
  984.  
  985. // Implementation
  986. public:
  987.     virtual ~CPaintDC();
  988. #ifdef _DEBUG
  989.     virtual void AssertValid() const;
  990.     virtual void Dump(CDumpContext& dc) const;
  991. #endif
  992. };
  993.  
  994. class CClientDC : public CDC
  995. {
  996.     DECLARE_DYNAMIC(CClientDC)
  997.  
  998. // Constructors
  999. public:
  1000.     CClientDC(CWnd* pWnd);
  1001.  
  1002. // Attributes
  1003. protected:
  1004.     HWND m_hWnd;
  1005.  
  1006. // Implementation
  1007. public:
  1008.     virtual ~CClientDC();
  1009. #ifdef _DEBUG
  1010.     virtual void AssertValid() const;
  1011.     virtual void Dump(CDumpContext& dc) const;
  1012. #endif
  1013. };
  1014.  
  1015. class CWindowDC : public CDC
  1016. {
  1017.     DECLARE_DYNAMIC(CWindowDC)
  1018.  
  1019. // Constructors
  1020. public:
  1021.     CWindowDC(CWnd* pWnd);
  1022.  
  1023. // Attributes
  1024. protected:
  1025.     HWND m_hWnd;
  1026.  
  1027. // Implementation
  1028. public:
  1029.     virtual ~CWindowDC();
  1030. #ifdef _DEBUG
  1031.     virtual void AssertValid() const;
  1032.     virtual void Dump(CDumpContext& dc) const;
  1033. #endif
  1034. };
  1035.  
  1036. /////////////////////////////////////////////////////////////////////////////
  1037. // CMenu
  1038.  
  1039. class CMenu : public CObject
  1040. {
  1041.     DECLARE_DYNCREATE(CMenu)
  1042. public:
  1043.  
  1044. // Constructors
  1045.     CMenu();
  1046.  
  1047.     BOOL CreateMenu();
  1048.     BOOL CreatePopupMenu();
  1049.     BOOL LoadMenu(LPCTSTR lpszResourceName);
  1050.     BOOL LoadMenu(UINT nIDResource);
  1051. WCE_DEL    BOOL LoadMenuIndirect(const void* lpMenuTemplate);
  1052.     BOOL DestroyMenu();
  1053.  
  1054. // Attributes
  1055.     HMENU m_hMenu;          // must be first data member
  1056.     HMENU GetSafeHmenu() const;
  1057.     operator HMENU() const;
  1058.  
  1059.     static CMenu* PASCAL FromHandle(HMENU hMenu);
  1060.     static void PASCAL DeleteTempMap();
  1061.     BOOL Attach(HMENU hMenu);
  1062.     HMENU Detach();
  1063.  
  1064. // CMenu Operations
  1065.     BOOL DeleteMenu(UINT nPosition, UINT nFlags);
  1066.     BOOL TrackPopupMenu(UINT nFlags, int x, int y,
  1067.                         CWnd* pWnd, LPCRECT lpRect = 0);
  1068.     BOOL operator==(const CMenu& menu) const;
  1069.     BOOL operator!=(const CMenu& menu) const;
  1070.  
  1071. // CMenuItem Operations
  1072.     BOOL AppendMenu(UINT nFlags, UINT nIDNewItem = 0,
  1073.                     LPCTSTR lpszNewItem = NULL);
  1074.     BOOL AppendMenu(UINT nFlags, UINT nIDNewItem, const CBitmap* pBmp);
  1075.     UINT CheckMenuItem(UINT nIDCheckItem, UINT nCheck);
  1076.     UINT EnableMenuItem(UINT nIDEnableItem, UINT nEnable);
  1077.     UINT GetMenuItemCount() const;
  1078.     UINT GetMenuItemID(int nPos) const;
  1079.     UINT GetMenuState(UINT nID, UINT nFlags) const;
  1080.     int GetMenuString(UINT nIDItem, LPTSTR lpString, int nMaxCount,
  1081.                     UINT nFlags) const;
  1082.     int GetMenuString(UINT nIDItem, CString& rString, UINT nFlags) const;
  1083.     BOOL GetMenuItemInfo(UINT nIDItem, LPMENUITEMINFO lpMenuItemInfo,
  1084.                     BOOL fByPos = FALSE);
  1085.     CMenu* GetSubMenu(int nPos) const;
  1086.     BOOL InsertMenu(UINT nPosition, UINT nFlags, UINT nIDNewItem = 0,
  1087.                     LPCTSTR lpszNewItem = NULL);
  1088.     BOOL InsertMenu(UINT nPosition, UINT nFlags, UINT nIDNewItem,
  1089.                     const CBitmap* pBmp);
  1090.     BOOL ModifyMenu(UINT nPosition, UINT nFlags, UINT nIDNewItem = 0,
  1091.                     LPCTSTR lpszNewItem = NULL);
  1092.     BOOL ModifyMenu(UINT nPosition, UINT nFlags, UINT nIDNewItem,
  1093.                     const CBitmap* pBmp);
  1094.     BOOL RemoveMenu(UINT nPosition, UINT nFlags);
  1095. WCE_DEL    BOOL SetMenuItemBitmaps(UINT nPosition, UINT nFlags, const CBitmap* pBmpUnchecked, const CBitmap* pBmpChecked);
  1096.     BOOL CheckMenuRadioItem(UINT nIDFirst, UINT nIDLast, UINT nIDItem, UINT nFlags);
  1097. WCE_DEL    BOOL SetDefaultItem(UINT uItem, BOOL fByPos = FALSE);
  1098. WCE_DEL    UINT GetDefaultItem(UINT gmdiFlags, BOOL fByPos = FALSE);
  1099.  
  1100. // Context Help Functions
  1101. WCE_DEL BOOL SetMenuContextHelpId(DWORD dwContextHelpId);
  1102. WCE_DEL DWORD GetMenuContextHelpId() const;
  1103.  
  1104. // Overridables (must override draw and measure for owner-draw menu items)
  1105.     virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
  1106.     virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
  1107.  
  1108. // Implementation
  1109. public:
  1110.     virtual ~CMenu();
  1111. #ifdef _DEBUG
  1112.     virtual void AssertValid() const;
  1113.     virtual void Dump(CDumpContext& dc) const;
  1114. #endif
  1115.     static CMenu* PASCAL CMenu::FromHandlePermanent(HMENU hMenu);
  1116. };
  1117.  
  1118. /////////////////////////////////////////////////////////////////////////////
  1119. // Window message map handling
  1120.  
  1121. struct AFX_MSGMAP_ENTRY;       // declared below after CWnd
  1122.  
  1123. struct AFX_MSGMAP
  1124. {
  1125. #ifdef _AFXDLL
  1126.     const AFX_MSGMAP* (PASCAL* pfnGetBaseMap)();
  1127. #else
  1128.     const AFX_MSGMAP* pBaseMap;
  1129. #endif
  1130.     const AFX_MSGMAP_ENTRY* lpEntries;
  1131. };
  1132.  
  1133. #ifdef _AFXDLL
  1134. #define DECLARE_MESSAGE_MAP() \
  1135. private: \
  1136.     static const AFX_MSGMAP_ENTRY _messageEntries[]; \
  1137. protected: \
  1138.     static AFX_DATA const AFX_MSGMAP messageMap; \
  1139.     static const AFX_MSGMAP* PASCAL _GetBaseMessageMap(); \
  1140.     virtual const AFX_MSGMAP* GetMessageMap() const; \
  1141.  
  1142. #else
  1143. #define DECLARE_MESSAGE_MAP() \
  1144. private: \
  1145.     static const AFX_MSGMAP_ENTRY _messageEntries[]; \
  1146. protected: \
  1147.     static AFX_DATA const AFX_MSGMAP messageMap; \
  1148.     virtual const AFX_MSGMAP* GetMessageMap() const; \
  1149.  
  1150. #endif
  1151.  
  1152. #ifdef _AFXDLL
  1153. #define BEGIN_MESSAGE_MAP(theClass, baseClass) \
  1154.     const AFX_MSGMAP* PASCAL theClass::_GetBaseMessageMap() \
  1155.         { return &baseClass::messageMap; } \
  1156.     const AFX_MSGMAP* theClass::GetMessageMap() const \
  1157.         { return &theClass::messageMap; } \
  1158.     AFX_COMDAT AFX_DATADEF const AFX_MSGMAP theClass::messageMap = \
  1159.     { &theClass::_GetBaseMessageMap, &theClass::_messageEntries[0] }; \
  1160.     AFX_COMDAT const AFX_MSGMAP_ENTRY theClass::_messageEntries[] = \
  1161.     { \
  1162.  
  1163. #else
  1164. #define BEGIN_MESSAGE_MAP(theClass, baseClass) \
  1165.     const AFX_MSGMAP* theClass::GetMessageMap() const \
  1166.         { return &theClass::messageMap; } \
  1167.     AFX_COMDAT AFX_DATADEF const AFX_MSGMAP theClass::messageMap = \
  1168.     { &baseClass::messageMap, &theClass::_messageEntries[0] }; \
  1169.     AFX_COMDAT const AFX_MSGMAP_ENTRY theClass::_messageEntries[] = \
  1170.     { \
  1171.  
  1172. #endif
  1173.  
  1174. #define END_MESSAGE_MAP() \
  1175.         {0, 0, 0, 0, AfxSig_end, (AFX_PMSG)0 } \
  1176.     }; \
  1177.  
  1178. // Message map signature values and macros in separate header
  1179. #include <afxmsg_.h>
  1180.  
  1181. /////////////////////////////////////////////////////////////////////////////
  1182. // Dialog data exchange (DDX_) and validation (DDV_)
  1183.  
  1184. // CDataExchange - for data exchange and validation
  1185. class CDataExchange
  1186. {
  1187. // Attributes
  1188. public:
  1189.     BOOL m_bSaveAndValidate;   // TRUE => save and validate data
  1190.     CWnd* m_pDlgWnd;           // container usually a dialog
  1191.  
  1192. // Operations (for implementors of DDX and DDV procs)
  1193.     HWND PrepareCtrl(int nIDC);     // return HWND of control
  1194.     HWND PrepareEditCtrl(int nIDC); // return HWND of control
  1195.     void Fail();                    // will throw exception
  1196.  
  1197. #ifndef _AFX_NO_OCC_SUPPORT
  1198.     CWnd* PrepareOleCtrl(int nIDC); // for OLE controls in dialog
  1199. #endif
  1200.  
  1201. // Implementation
  1202.     CDataExchange(CWnd* pDlgWnd, BOOL bSaveAndValidate);
  1203.  
  1204.     HWND m_hWndLastControl;    // last control used (for validation)
  1205.     BOOL m_bEditLastControl;   // last control was an edit item
  1206. };
  1207.  
  1208. #include <afxdd_.h>     // standard DDX_ and DDV_ routines
  1209.  
  1210. /////////////////////////////////////////////////////////////////////////////
  1211. // OLE types
  1212.  
  1213. #if !defined(_WIN32_WCE_NO_OLE)
  1214. typedef LONG HRESULT;
  1215.  
  1216. struct IUnknown;
  1217. typedef IUnknown* LPUNKNOWN;
  1218.  
  1219. struct IDispatch;
  1220. typedef IDispatch* LPDISPATCH;
  1221.  
  1222. struct IConnectionPoint;
  1223. typedef IConnectionPoint* LPCONNECTIONPOINT;
  1224.  
  1225. struct IEnumOLEVERB;
  1226. typedef IEnumOLEVERB* LPENUMOLEVERB;
  1227.  
  1228. typedef struct _GUID GUID;
  1229. typedef GUID IID;
  1230. typedef GUID CLSID;
  1231. #ifndef _REFCLSID_DEFINED
  1232. #define REFCLSID const CLSID &
  1233. #endif
  1234.  
  1235. typedef long DISPID;
  1236. typedef unsigned short VARTYPE;
  1237. typedef long SCODE;
  1238.  
  1239. #if defined(WIN32) && !defined(OLE2ANSI)
  1240. typedef WCHAR OLECHAR;
  1241. #else
  1242. typedef char OLECHAR;
  1243. #endif
  1244. typedef OLECHAR* BSTR;
  1245.  
  1246. struct tagDISPPARAMS;
  1247. typedef tagDISPPARAMS DISPPARAMS;
  1248.  
  1249. struct tagVARIANT;
  1250. typedef tagVARIANT VARIANT;
  1251.  
  1252. struct ITypeInfo;
  1253. typedef ITypeInfo* LPTYPEINFO;
  1254.  
  1255. struct ITypeLib;
  1256. typedef ITypeLib* LPTYPELIB;
  1257. #endif // _WIN32_WCE_NO_OLE
  1258.  
  1259. /////////////////////////////////////////////////////////////////////////////
  1260. // CCmdTarget
  1261.  
  1262. // private structures
  1263. struct AFX_CMDHANDLERINFO;  // info about where the command is handled
  1264. struct AFX_EVENT;           // info about an event
  1265. class CTypeLibCache;        // cache for OLE type libraries
  1266.  
  1267. /////////////////////////////////////////////////////////////////////////////
  1268. // OLE interface map handling (more in AFXDISP.H)
  1269.  
  1270. #ifndef _AFX_NO_OLE_SUPPORT
  1271.  
  1272. struct AFX_INTERFACEMAP_ENTRY
  1273. {
  1274.     const void* piid;       // the interface id (IID) (NULL for aggregate)
  1275.     size_t nOffset;         // offset of the interface vtable from m_unknown
  1276. };
  1277.  
  1278. struct AFX_INTERFACEMAP
  1279. {
  1280. #ifdef _AFXDLL
  1281.     const AFX_INTERFACEMAP* (PASCAL* pfnGetBaseMap)(); // NULL is root class
  1282. #else
  1283.     const AFX_INTERFACEMAP* pBaseMap;
  1284. #endif
  1285.     const AFX_INTERFACEMAP_ENTRY* pEntry; // map for this class
  1286. };
  1287.  
  1288.  
  1289. #ifdef _AFXDLL
  1290. #define DECLARE_INTERFACE_MAP() \
  1291. private: \
  1292.     static const AFX_INTERFACEMAP_ENTRY _interfaceEntries[]; \
  1293. protected: \
  1294.     static AFX_DATA const AFX_INTERFACEMAP interfaceMap; \
  1295.     static const AFX_INTERFACEMAP* PASCAL _GetBaseInterfaceMap(); \
  1296.     virtual const AFX_INTERFACEMAP* GetInterfaceMap() const; \
  1297.  
  1298. #else
  1299. #define DECLARE_INTERFACE_MAP() \
  1300. private: \
  1301.     static const AFX_INTERFACEMAP_ENTRY _interfaceEntries[]; \
  1302. protected: \
  1303.     static AFX_DATA const AFX_INTERFACEMAP interfaceMap; \
  1304.     virtual const AFX_INTERFACEMAP* GetInterfaceMap() const; \
  1305.  
  1306. #endif
  1307.  
  1308. #endif //!_AFX_NO_OLE_SUPPORT
  1309.  
  1310. /////////////////////////////////////////////////////////////////////////////
  1311. // OLE dispatch map handling (more in AFXDISP.H)
  1312.  
  1313. #ifndef _AFX_NO_OLE_SUPPORT
  1314.  
  1315. struct AFX_DISPMAP_ENTRY;
  1316.  
  1317. struct AFX_DISPMAP
  1318. {
  1319. #ifdef _AFXDLL
  1320.     const AFX_DISPMAP* (PASCAL* pfnGetBaseMap)();
  1321. #else
  1322.     const AFX_DISPMAP* pBaseMap;
  1323. #endif
  1324.     const AFX_DISPMAP_ENTRY* lpEntries;
  1325.     UINT* lpEntryCount;
  1326.     DWORD* lpStockPropMask;
  1327. };
  1328.  
  1329. #ifdef _AFXDLL
  1330. #define DECLARE_DISPATCH_MAP() \
  1331. private: \
  1332.     static const AFX_DISPMAP_ENTRY _dispatchEntries[]; \
  1333.     static UINT _dispatchEntryCount; \
  1334.     static DWORD _dwStockPropMask; \
  1335. protected: \
  1336.     static AFX_DATA const AFX_DISPMAP dispatchMap; \
  1337.     static const AFX_DISPMAP* PASCAL _GetBaseDispatchMap(); \
  1338.     virtual const AFX_DISPMAP* GetDispatchMap() const; \
  1339.  
  1340. #else
  1341. #define DECLARE_DISPATCH_MAP() \
  1342. private: \
  1343.     static const AFX_DISPMAP_ENTRY _dispatchEntries[]; \
  1344.     static UINT _dispatchEntryCount; \
  1345.     static DWORD _dwStockPropMask; \
  1346. protected: \
  1347.     static AFX_DATA const AFX_DISPMAP dispatchMap; \
  1348.     virtual const AFX_DISPMAP* GetDispatchMap() const; \
  1349.  
  1350. #endif
  1351.  
  1352. #endif //!_AFX_NO_OLE_SUPPORT
  1353.  
  1354. /////////////////////////////////////////////////////////////////////////////
  1355. // OLE Document Object command target handling
  1356.  
  1357. #ifndef _AFX_NO_DOCOBJECT_SUPPORT
  1358.  
  1359. struct AFX_OLECMDMAP_ENTRY
  1360. {
  1361.    const GUID* pguid;   // id of the command group
  1362.    ULONG       cmdID;   // OLECMD ID
  1363.    UINT        nID;     // corresponding WM_COMMAND message ID
  1364. };
  1365.  
  1366. struct AFX_OLECMDMAP
  1367. {
  1368. #ifdef _AFXDLL
  1369.     const AFX_OLECMDMAP* (PASCAL* pfnGetBaseMap)();
  1370. #else
  1371.     const AFX_OLECMDMAP* pBaseMap;
  1372. #endif
  1373.     const AFX_OLECMDMAP_ENTRY* lpEntries;
  1374. };
  1375.  
  1376. #ifdef _AFXDLL
  1377. #define DECLARE_OLECMD_MAP() \
  1378. private: \
  1379.     static const AFX_OLECMDMAP_ENTRY _commandEntries[]; \
  1380. protected: \
  1381.     static AFX_DATA const AFX_OLECMDMAP commandMap; \
  1382.     static const AFX_OLECMDMAP* PASCAL _GetBaseCommandMap(); \
  1383.     virtual const AFX_OLECMDMAP* GetCommandMap() const; \
  1384.  
  1385. #else
  1386. #define DECLARE_OLECMD_MAP() \
  1387. private: \
  1388.     static const AFX_OLECMDMAP_ENTRY _commandEntries[]; \
  1389. protected: \
  1390.     static AFX_DATA const AFX_OLECMDMAP commandMap; \
  1391.     virtual const AFX_OLECMDMAP* GetCommandMap() const; \
  1392.  
  1393. #endif
  1394.  
  1395. #ifdef _AFXDLL
  1396. #define BEGIN_OLECMD_MAP(theClass, baseClass) \
  1397.     const AFX_OLECMDMAP* PASCAL theClass::_GetBaseCommandMap() \
  1398.         { return &baseClass::commandMap; } \
  1399.     const AFX_OLECMDMAP* theClass::GetCommandMap() const \
  1400.         { return &theClass::commandMap; } \
  1401.     AFX_COMDAT AFX_DATADEF const AFX_OLECMDMAP theClass::commandMap = \
  1402.     { &theClass::_GetBaseCommandMap, &theClass::_commandEntries[0] }; \
  1403.     AFX_COMDAT const AFX_OLECMDMAP_ENTRY theClass::_commandEntries[] = \
  1404.     { \
  1405.  
  1406. #else
  1407. #define BEGIN_OLECMD_MAP(theClass, baseClass) \
  1408.     const AFX_OLECMDMAP* theClass::GetCommandMap() const \
  1409.         { return &theClass::commandMap; } \
  1410.     AFX_COMDAT AFX_DATADEF const AFX_OLECMDMAP theClass::commandMap = \
  1411.     { &baseClass::commandMap, &theClass::_commandEntries[0] }; \
  1412.     AFX_COMDAT const AFX_OLECMDMAP_ENTRY theClass::_commandEntries[] = \
  1413.     { \
  1414.  
  1415. #endif
  1416.  
  1417. #define END_OLECMD_MAP() \
  1418.         {NULL, 0, 0} \
  1419.     }; \
  1420.  
  1421. class COleCmdUI;
  1422.  
  1423. #endif //!_AFX_NO_DOCOBJECT_SUPPORT
  1424.  
  1425. /////////////////////////////////////////////////////////////////////////////
  1426. // OLE event sink map handling (more in AFXDISP.H)
  1427.  
  1428. #ifndef _AFX_NO_OCC_SUPPORT
  1429.  
  1430. struct AFX_EVENTSINKMAP_ENTRY;
  1431.  
  1432. struct AFX_EVENTSINKMAP
  1433. {
  1434. #ifdef _AFXDLL
  1435.     const AFX_EVENTSINKMAP* (PASCAL* pfnGetBaseMap)();
  1436. #else
  1437.     const AFX_EVENTSINKMAP* pBaseMap;
  1438. #endif
  1439.     const AFX_EVENTSINKMAP_ENTRY* lpEntries;
  1440.     UINT* lpEntryCount;
  1441. };
  1442.  
  1443. #ifdef _AFXDLL
  1444. #define DECLARE_EVENTSINK_MAP() \
  1445. private: \
  1446.     static const AFX_EVENTSINKMAP_ENTRY _eventsinkEntries[]; \
  1447.     static UINT _eventsinkEntryCount; \
  1448. protected: \
  1449.     static AFX_DATA const AFX_EVENTSINKMAP eventsinkMap; \
  1450.     static const AFX_EVENTSINKMAP* PASCAL _GetBaseEventSinkMap(); \
  1451.     virtual const AFX_EVENTSINKMAP* GetEventSinkMap() const; \
  1452.  
  1453. #else
  1454. #define DECLARE_EVENTSINK_MAP() \
  1455. private: \
  1456.     static const AFX_EVENTSINKMAP_ENTRY _eventsinkEntries[]; \
  1457.     static UINT _eventsinkEntryCount; \
  1458. protected: \
  1459.     static AFX_DATA const AFX_EVENTSINKMAP eventsinkMap; \
  1460.     virtual const AFX_EVENTSINKMAP* GetEventSinkMap() const; \
  1461.  
  1462. #endif
  1463.  
  1464. #endif //!_AFX_NO_OCC_SUPPORT
  1465.  
  1466. /////////////////////////////////////////////////////////////////////////////
  1467. // OLE connection map handling (more in AFXDISP.H)
  1468.  
  1469. #ifndef _AFX_NO_OLE_SUPPORT
  1470.  
  1471. struct AFX_CONNECTIONMAP_ENTRY
  1472. {
  1473.     const void* piid;   // the interface id (IID)
  1474.     size_t nOffset;         // offset of the interface vtable from m_unknown
  1475. };
  1476.  
  1477. struct AFX_CONNECTIONMAP
  1478. {
  1479. #ifdef _AFXDLL
  1480.     const AFX_CONNECTIONMAP* (PASCAL* pfnGetBaseMap)(); // NULL is root class
  1481. #else
  1482.     const AFX_CONNECTIONMAP* pBaseMap;
  1483. #endif
  1484.     const AFX_CONNECTIONMAP_ENTRY* pEntry; // map for this class
  1485. };
  1486.  
  1487. #ifdef _AFXDLL
  1488. #define DECLARE_CONNECTION_MAP() \
  1489. private: \
  1490.     static const AFX_CONNECTIONMAP_ENTRY _connectionEntries[]; \
  1491. protected: \
  1492.     static AFX_DATA const AFX_CONNECTIONMAP connectionMap; \
  1493.     static const AFX_CONNECTIONMAP* PASCAL _GetBaseConnectionMap(); \
  1494.     virtual const AFX_CONNECTIONMAP* GetConnectionMap() const; \
  1495.  
  1496. #else
  1497. #define DECLARE_CONNECTION_MAP() \
  1498. private: \
  1499.     static const AFX_CONNECTIONMAP_ENTRY _connectionEntries[]; \
  1500. protected: \
  1501.     static AFX_DATA const AFX_CONNECTIONMAP connectionMap; \
  1502.     virtual const AFX_CONNECTIONMAP* GetConnectionMap() const; \
  1503.  
  1504. #endif
  1505.  
  1506. #endif //!_AFX_NO_OLE_SUPPORT
  1507.  
  1508. /////////////////////////////////////////////////////////////////////////////
  1509. // CCmdTarget proper
  1510.  
  1511. #ifndef _AFX_NO_OCC_SUPPORT
  1512. class COccManager;      // forward reference (see ..\src\occimpl.h)
  1513. #endif
  1514.  
  1515. #ifdef _AFXDLL
  1516. class CCmdTarget : public CObject
  1517. #else
  1518. class AFX_NOVTABLE CCmdTarget : public CObject
  1519. #endif
  1520. {
  1521.     DECLARE_DYNAMIC(CCmdTarget)
  1522. protected:
  1523.  
  1524. public:
  1525. #if defined(_WIN32_WCE)
  1526. #ifdef _AFX_NO_OLE_SUPPORT
  1527.     AFX_MODULE_STATE* m_pModuleState;
  1528. #endif
  1529. #endif // _WIN32_WCE
  1530. // Constructors
  1531.     CCmdTarget();
  1532.  
  1533. // Attributes
  1534. #if !defined(_WIN32_WCE_NO_OLE)
  1535.     LPDISPATCH GetIDispatch(BOOL bAddRef);
  1536.         // retrieve IDispatch part of CCmdTarget
  1537.     static CCmdTarget* PASCAL FromIDispatch(LPDISPATCH lpDispatch);
  1538.         // map LPDISPATCH back to CCmdTarget* (inverse of GetIDispatch)
  1539.     BOOL IsResultExpected();
  1540.         // returns TRUE if automation function should return a value
  1541.  
  1542. // Operations
  1543.     void EnableAutomation();
  1544.         // call in constructor to wire up IDispatch
  1545.     void EnableConnections();
  1546.         // call in constructor to wire up IConnectionPointContainer
  1547. #endif // _WIN32_WCE_NO_OLE
  1548.  
  1549.     void BeginWaitCursor();
  1550.     void EndWaitCursor();
  1551.     void RestoreWaitCursor();       // call after messagebox
  1552.  
  1553. #ifndef _AFX_NO_OLE_SUPPORT
  1554.     // dispatch OLE verbs through the message map
  1555.     BOOL EnumOleVerbs(LPENUMOLEVERB* ppenumOleVerb);
  1556.     BOOL DoOleVerb(LONG iVerb, LPMSG lpMsg, HWND hWndParent, LPCRECT lpRect);
  1557. #endif
  1558.  
  1559. // Overridables
  1560.     // route and dispatch standard command message types
  1561.     //   (more sophisticated than OnCommand)
  1562.     virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,
  1563.         AFX_CMDHANDLERINFO* pHandlerInfo);
  1564.  
  1565. #ifndef _AFX_NO_OLE_SUPPORT
  1566.     // called when last OLE reference is released
  1567.     virtual void OnFinalRelease();
  1568. #endif
  1569.  
  1570. #ifndef _AFX_NO_OLE_SUPPORT
  1571.     // called before dispatching to an automation handler function
  1572.     virtual BOOL IsInvokeAllowed(DISPID dispid);
  1573. #endif
  1574.  
  1575. #ifndef _AFX_NO_OLE_SUPPORT
  1576.     // support for OLE type libraries
  1577.     void EnableTypeLib();
  1578.     HRESULT GetTypeInfoOfGuid(LCID lcid, const GUID& guid,
  1579.         LPTYPEINFO* ppTypeInfo);
  1580.     virtual BOOL GetDispatchIID(IID* pIID);
  1581.     virtual UINT GetTypeInfoCount();
  1582.     virtual CTypeLibCache* GetTypeLibCache();
  1583.     virtual HRESULT GetTypeLib(LCID lcid, LPTYPELIB* ppTypeLib);
  1584. #endif
  1585.  
  1586. // Implementation
  1587. public:
  1588.     virtual ~CCmdTarget();
  1589. #ifdef _DEBUG
  1590.     virtual void Dump(CDumpContext& dc) const;
  1591.     virtual void AssertValid() const;
  1592. #endif
  1593. #ifndef _AFX_NO_OLE_SUPPORT
  1594.     void GetNotSupported();
  1595.     void SetNotSupported();
  1596. #endif
  1597.  
  1598. protected:
  1599.     friend class CView;
  1600.  
  1601.     CView* GetRoutingView();
  1602.     CFrameWnd* GetRoutingFrame();
  1603.     static CView* PASCAL GetRoutingView_();
  1604.     static CFrameWnd* PASCAL GetRoutingFrame_();
  1605.     DECLARE_MESSAGE_MAP()       // base class - no {{ }} macros
  1606.  
  1607. #ifndef _AFX_NO_DOCOBJECT_SUPPORT
  1608.     DECLARE_OLECMD_MAP()
  1609.     friend class COleCmdUI;
  1610. #endif
  1611.  
  1612. #ifndef _AFX_NO_OLE_SUPPORT
  1613.     DECLARE_DISPATCH_MAP()
  1614.     DECLARE_CONNECTION_MAP()
  1615.     DECLARE_INTERFACE_MAP()
  1616.  
  1617. #ifndef _AFX_NO_OCC_SUPPORT
  1618.     DECLARE_EVENTSINK_MAP()
  1619. #endif // !_AFX_NO_OCC_SUPPORT
  1620.  
  1621.     // OLE interface map implementation
  1622. public:
  1623.     // data used when CCmdTarget is made OLE aware
  1624.     long m_dwRef;
  1625.     LPUNKNOWN m_pOuterUnknown;  // external controlling unknown if != NULL
  1626.     DWORD m_xInnerUnknown;  // place-holder for inner controlling unknown
  1627.  
  1628. public:
  1629.     // advanced operations
  1630.     void EnableAggregation();       // call to enable aggregation
  1631.     void ExternalDisconnect();      // forcibly disconnect
  1632.     LPUNKNOWN GetControllingUnknown();
  1633.         // get controlling IUnknown for aggregate creation
  1634.  
  1635.     // these versions do not delegate to m_pOuterUnknown
  1636.     DWORD InternalQueryInterface(const void*, LPVOID* ppvObj);
  1637.     DWORD InternalAddRef();
  1638.     DWORD InternalRelease();
  1639.     // these versions delegate to m_pOuterUnknown
  1640.     DWORD ExternalQueryInterface(const void*, LPVOID* ppvObj);
  1641.     DWORD ExternalAddRef();
  1642.     DWORD ExternalRelease();
  1643.  
  1644.     // implementation helpers
  1645.     LPUNKNOWN GetInterface(const void*);
  1646.     LPUNKNOWN QueryAggregates(const void*);
  1647.  
  1648.     // advanced overrideables for implementation
  1649.     virtual BOOL OnCreateAggregates();
  1650.     virtual LPUNKNOWN GetInterfaceHook(const void*);
  1651.  
  1652.     // OLE automation implementation
  1653. protected:
  1654.     struct XDispatch
  1655.     {
  1656.         DWORD m_vtbl;   // place-holder for IDispatch vtable
  1657. #ifndef _AFX_NO_NESTED_DERIVATION
  1658.         size_t m_nOffset;
  1659. #endif
  1660.     } m_xDispatch;
  1661.     BOOL m_bResultExpected;
  1662.  
  1663.     // member variable-based properties
  1664.     void GetStandardProp(const AFX_DISPMAP_ENTRY* pEntry,
  1665.         VARIANT* pvarResult, UINT* puArgErr);
  1666.     SCODE SetStandardProp(const AFX_DISPMAP_ENTRY* pEntry,
  1667.         DISPPARAMS* pDispParams, UINT* puArgErr);
  1668.  
  1669.     // DISPID to dispatch map lookup
  1670.     static UINT PASCAL GetEntryCount(const AFX_DISPMAP* pDispMap);
  1671.     const AFX_DISPMAP_ENTRY* PASCAL GetDispEntry(LONG memid);
  1672.     static LONG PASCAL MemberIDFromName(const AFX_DISPMAP* pDispMap, LPCTSTR lpszName);
  1673.  
  1674.     // helpers for member function calling implementation
  1675.     static UINT PASCAL GetStackSize(const BYTE* pbParams, VARTYPE vtResult);
  1676. #ifdef _PPC_
  1677.     SCODE PushStackArgs(BYTE* pStack, const BYTE* pbParams,
  1678.         void* pResult, VARTYPE vtResult, DISPPARAMS* pDispParams,
  1679.         UINT* puArgErr, VARIANT* rgTempVars, UINT nSizeArgs);
  1680. #else
  1681.     SCODE PushStackArgs(BYTE* pStack, const BYTE* pbParams,
  1682.         void* pResult, VARTYPE vtResult, DISPPARAMS* pDispParams,
  1683.         UINT* puArgErr, VARIANT* rgTempVars);
  1684. #endif
  1685.     SCODE CallMemberFunc(const AFX_DISPMAP_ENTRY* pEntry, WORD wFlags,
  1686.         VARIANT* pvarResult, DISPPARAMS* pDispParams, UINT* puArgErr);
  1687.  
  1688.     friend class COleDispatchImpl;
  1689.  
  1690. #ifndef _AFX_NO_OCC_SUPPORT
  1691. public:
  1692.     // OLE event sink implementation
  1693.     BOOL OnEvent(UINT idCtrl, AFX_EVENT* pEvent,
  1694.         AFX_CMDHANDLERINFO* pHandlerInfo);
  1695. protected:
  1696.     const AFX_EVENTSINKMAP_ENTRY* PASCAL GetEventSinkEntry(UINT idCtrl,
  1697.         AFX_EVENT* pEvent);
  1698. #endif // !_AFX_NO_OCC_SUPPORT
  1699.  
  1700.     // OLE connection implementation
  1701.     struct XConnPtContainer
  1702.     {
  1703.         DWORD m_vtbl;   // place-holder for IConnectionPointContainer vtable
  1704. #ifndef _AFX_NO_NESTED_DERIVATION
  1705.         size_t m_nOffset;
  1706. #endif
  1707.     } m_xConnPtContainer;
  1708.  
  1709. #ifdef _AFXDLL
  1710.     AFX_MODULE_STATE* m_pModuleState;
  1711.     friend class CInnerUnknown;
  1712.     friend UINT APIENTRY _AfxThreadEntry(void* pParam);
  1713. #endif
  1714.  
  1715.     virtual BOOL GetExtraConnectionPoints(CPtrArray* pConnPoints);
  1716.     virtual LPCONNECTIONPOINT GetConnectionHook(const IID& iid);
  1717.  
  1718.     friend class COleConnPtContainer;
  1719.  
  1720. #endif //!_AFX_NO_OLE_SUPPORT
  1721. };
  1722.  
  1723. class CCmdUI        // simple helper class
  1724. {
  1725. public:
  1726. // Attributes
  1727.     UINT m_nID;
  1728.     UINT m_nIndex;          // menu item or other index
  1729.  
  1730.     // if a menu item
  1731.     CMenu* m_pMenu;         // NULL if not a menu
  1732.     CMenu* m_pSubMenu;      // sub containing menu item
  1733.                             // if a popup sub menu - ID is for first in popup
  1734.  
  1735.     // if from some other window
  1736.     CWnd* m_pOther;         // NULL if a menu or not a CWnd
  1737.  
  1738. // Operations to do in ON_UPDATE_COMMAND_UI
  1739.     virtual void Enable(BOOL bOn = TRUE);
  1740.     virtual void SetCheck(int nCheck = 1);   // 0, 1 or 2 (indeterminate)
  1741.     virtual void SetRadio(BOOL bOn = TRUE);
  1742.     virtual void SetText(LPCTSTR lpszText);
  1743.  
  1744. // Advanced operation
  1745.     void ContinueRouting();
  1746.  
  1747. // Implementation
  1748.     CCmdUI();
  1749.     BOOL m_bEnableChanged;
  1750.     BOOL m_bContinueRouting;
  1751.     UINT m_nIndexMax;       // last + 1 for iterating m_nIndex
  1752.  
  1753.     CMenu* m_pParentMenu;   // NULL if parent menu not easily determined
  1754.                             //  (probably a secondary popup menu)
  1755.  
  1756.     BOOL DoUpdate(CCmdTarget* pTarget, BOOL bDisableIfNoHndler);
  1757. };
  1758.  
  1759. // special CCmdUI derived classes are used for other UI paradigms
  1760. //  like toolbar buttons and status indicators
  1761.  
  1762. // pointer to afx_msg member function
  1763. #ifndef AFX_MSG_CALL
  1764. #define AFX_MSG_CALL
  1765. #endif
  1766. typedef void (AFX_MSG_CALL CCmdTarget::*AFX_PMSG)(void);
  1767.  
  1768. enum AFX_DISPMAP_FLAGS
  1769. {
  1770.     afxDispCustom = 0,
  1771.     afxDispStock = 1
  1772. };
  1773.  
  1774. struct AFX_DISPMAP_ENTRY
  1775. {
  1776.     LPCTSTR lpszName;       // member/property name
  1777.     long lDispID;           // DISPID (may be DISPID_UNKNOWN)
  1778.     LPCSTR lpszParams;      // member parameter description
  1779.     WORD vt;                // return value type / or type of property
  1780.     AFX_PMSG pfn;           // normal member On<membercall> or, OnGet<property>
  1781.     AFX_PMSG pfnSet;        // special member for OnSet<property>
  1782.     size_t nPropOffset;     // property offset
  1783.     AFX_DISPMAP_FLAGS flags;// flags (e.g. stock/custom)
  1784. };
  1785.  
  1786. struct AFX_EVENTSINKMAP_ENTRY
  1787. {
  1788.     AFX_DISPMAP_ENTRY dispEntry;
  1789.     UINT nCtrlIDFirst;
  1790.     UINT nCtrlIDLast;
  1791. };
  1792.  
  1793. #if !defined(_WIN32_WCE_NO_OLE)
  1794. // DSC Sink state/reason codes passed to MFC user event handlers
  1795. enum DSCSTATE
  1796. {
  1797.     dscNoState = 0,
  1798.     dscOKToDo,
  1799.     dscCancelled,
  1800.     dscSyncBefore,
  1801.     dscAboutToDo,
  1802.     dscFailedToDo,
  1803.     dscSyncAfter,
  1804.     dscDidEvent
  1805. };
  1806.  
  1807. enum DSCREASON
  1808. {
  1809.     dscNoReason = 0,
  1810.     dscClose,
  1811.     dscCommit,
  1812.     dscDelete,
  1813.     dscEdit,
  1814.     dscInsert,
  1815.     dscModify,
  1816.     dscMove
  1817. };
  1818. #endif // _WIN32_WCE_NO_OLE
  1819.  
  1820. /////////////////////////////////////////////////////////////////////////////
  1821. // CWnd implementation
  1822.  
  1823. // structures (see afxext.h)
  1824. struct CCreateContext;      // context for creating things
  1825. struct CPrintInfo;          // print preview customization info
  1826.  
  1827. struct AFX_MSGMAP_ENTRY
  1828. {
  1829.     UINT nMessage;   // windows message
  1830.     UINT nCode;      // control code or WM_NOTIFY code
  1831.     UINT nID;        // control ID (or 0 for windows messages)
  1832.     UINT nLastID;    // used for entries specifying a range of control id's
  1833.     UINT nSig;       // signature type (action) or pointer to message #
  1834.     AFX_PMSG pfn;    // routine to call (or special value)
  1835. };
  1836.  
  1837. /////////////////////////////////////////////////////////////////////////////
  1838. // CWnd - a Microsoft Windows application window
  1839.  
  1840. class COleDropTarget;   // for more information see AFXOLE.H
  1841. class COleControlContainer;
  1842. class COleControlSite;
  1843.  
  1844. // CWnd::m_nFlags (generic to CWnd)
  1845. #define WF_TOOLTIPS         0x0001  // window is enabled for tooltips
  1846. #define WF_TEMPHIDE         0x0002  // window is temporarily hidden
  1847. #define WF_STAYDISABLED     0x0004  // window should stay disabled
  1848. #define WF_MODALLOOP        0x0008  // currently in modal loop
  1849. #define WF_CONTINUEMODAL    0x0010  // modal loop should continue running
  1850. #define WF_OLECTLCONTAINER  0x0100  // some descendant is an OLE control
  1851. #define WF_TRACKINGTOOLTIPS 0x0400  // window is enabled for tracking tooltips
  1852.  
  1853. // CWnd::m_nFlags (specific to CFrameWnd)
  1854. #define WF_STAYACTIVE       0x0020  // look active even though not active
  1855. #define WF_NOPOPMSG         0x0040  // ignore WM_POPMESSAGESTRING calls
  1856. #define WF_MODALDISABLE     0x0080  // window is disabled
  1857. #define WF_KEEPMINIACTIVE   0x0200  // stay activate even though you are deactivated
  1858.  
  1859. // flags for CWnd::RunModalLoop
  1860. #define MLF_NOIDLEMSG       0x0001  // don't send WM_ENTERIDLE messages
  1861. #define MLF_NOKICKIDLE      0x0002  // don't send WM_KICKIDLE messages
  1862. #define MLF_SHOWONIDLE      0x0004  // show window if not visible at idle time
  1863.  
  1864. // extra MFC defined TTF_ flags for TOOLINFO::uFlags
  1865. #define TTF_NOTBUTTON       0x80000000L // no status help on buttondown
  1866. #define TTF_ALWAYSTIP       0x40000000L // always show the tip even if not active
  1867.  
  1868. class CWnd : public CCmdTarget
  1869. {
  1870.     DECLARE_DYNCREATE(CWnd)
  1871. protected:
  1872.     static const MSG* PASCAL GetCurrentMessage();
  1873.  
  1874. // Attributes
  1875. public:
  1876.     HWND m_hWnd;            // must be first data member
  1877.     operator HWND() const;
  1878.     BOOL operator==(const CWnd& wnd) const;
  1879.     BOOL operator!=(const CWnd& wnd) const;
  1880.  
  1881.     HWND GetSafeHwnd() const;
  1882.     DWORD GetStyle() const;
  1883.     DWORD GetExStyle() const;
  1884.     BOOL ModifyStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0);
  1885.     BOOL ModifyStyleEx(DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0);
  1886.  
  1887.     CWnd* GetOwner() const;
  1888.     void SetOwner(CWnd* pOwnerWnd);
  1889.  
  1890. // Constructors and other creation
  1891.     CWnd();
  1892.  
  1893.     static CWnd* PASCAL FromHandle(HWND hWnd);
  1894.     static CWnd* PASCAL FromHandlePermanent(HWND hWnd);
  1895.     static void PASCAL DeleteTempMap();
  1896.     BOOL Attach(HWND hWndNew);
  1897.     HWND Detach();
  1898.  
  1899.     // subclassing/unsubclassing functions
  1900.     virtual void PreSubclassWindow();
  1901.     BOOL SubclassWindow(HWND hWnd);
  1902.     BOOL SubclassDlgItem(UINT nID, CWnd* pParent);
  1903.     HWND UnsubclassWindow();
  1904.  
  1905.     // handling of RT_DLGINIT resource (extension to RT_DIALOG)
  1906.     BOOL ExecuteDlgInit(LPCTSTR lpszResourceName);
  1907.     BOOL ExecuteDlgInit(LPVOID lpResource);
  1908.  
  1909. public:
  1910.     // for child windows, views, panes etc
  1911.     virtual BOOL Create(LPCTSTR lpszClassName,
  1912.         LPCTSTR lpszWindowName, DWORD dwStyle,
  1913.         const RECT& rect,
  1914.         CWnd* pParentWnd, UINT nID,
  1915.         CCreateContext* pContext = NULL);
  1916.  
  1917.     // advanced creation (allows access to extended styles)
  1918.     BOOL CreateEx(DWORD dwExStyle, LPCTSTR lpszClassName,
  1919.         LPCTSTR lpszWindowName, DWORD dwStyle,
  1920.         int x, int y, int nWidth, int nHeight,
  1921.         HWND hWndParent, HMENU nIDorHMenu, LPVOID lpParam = NULL);
  1922.  
  1923.     BOOL CreateEx(DWORD dwExStyle, LPCTSTR lpszClassName,
  1924.         LPCTSTR lpszWindowName, DWORD dwStyle,
  1925.         const RECT& rect,
  1926.         CWnd* pParentWnd, UINT nID,
  1927.         LPVOID lpParam = NULL);
  1928.  
  1929. #ifndef _AFX_NO_OCC_SUPPORT
  1930.     // for wrapping OLE controls
  1931.     BOOL CreateControl(REFCLSID clsid, LPCTSTR pszWindowName, DWORD dwStyle,
  1932.         const RECT& rect, CWnd* pParentWnd, UINT nID, CFile* pPersist=NULL,
  1933.         BOOL bStorage=FALSE, BSTR bstrLicKey=NULL);
  1934.  
  1935.     BOOL CreateControl(LPCTSTR pszClass, LPCTSTR pszWindowName, DWORD dwStyle,
  1936.         const RECT& rect, CWnd* pParentWnd, UINT nID, CFile* pPersist=NULL,
  1937.         BOOL bStorage=FALSE, BSTR bstrLicKey=NULL);
  1938.  
  1939.    // Another overload for creating controls that use default extents.
  1940.    BOOL CreateControl( REFCLSID clsid, LPCTSTR pszWindowName, DWORD dwStyle,
  1941.       const POINT* ppt, const SIZE* psize, CWnd* pParentWnd, UINT nID, 
  1942.       CFile* pPersist = NULL, BOOL bStorage = FALSE, BSTR bstrLicKey = NULL );
  1943.  
  1944.     LPUNKNOWN GetControlUnknown();
  1945. #endif
  1946.  
  1947.     virtual BOOL DestroyWindow();
  1948.  
  1949.     // special pre-creation and window rect adjustment hooks
  1950.     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  1951.  
  1952.     // Advanced: virtual AdjustWindowRect
  1953.     enum AdjustType { adjustBorder = 0, adjustOutside = 1 };
  1954.     virtual void CalcWindowRect(LPRECT lpClientRect,
  1955.         UINT nAdjustType = adjustBorder);
  1956.  
  1957. // Window tree access
  1958.     int GetDlgCtrlID() const;
  1959.     int SetDlgCtrlID(int nID);
  1960.         // get and set window ID, for child windows only
  1961.     CWnd* GetDlgItem(int nID) const;
  1962.         // get immediate child with given ID
  1963.     void GetDlgItem(int nID, HWND* phWnd) const;
  1964.         // as above, but returns HWND
  1965.     CWnd* GetDescendantWindow(int nID, BOOL bOnlyPerm = FALSE) const;
  1966.         // like GetDlgItem but recursive
  1967.     void SendMessageToDescendants(UINT message, WPARAM wParam = 0,
  1968.         LPARAM lParam = 0, BOOL bDeep = TRUE, BOOL bOnlyPerm = FALSE);
  1969.     CFrameWnd* GetParentFrame() const;
  1970.     CWnd* GetTopLevelParent() const;
  1971.     CWnd* GetTopLevelOwner() const;
  1972.     CWnd* GetParentOwner() const;
  1973.     CFrameWnd* GetTopLevelFrame() const;
  1974.     static CWnd* PASCAL GetSafeOwner(CWnd* pParent = NULL, HWND* pWndTop = NULL);
  1975.  
  1976. // Message Functions
  1977.     LRESULT SendMessage(UINT message, WPARAM wParam = 0, LPARAM lParam = 0);
  1978.     BOOL PostMessage(UINT message, WPARAM wParam = 0, LPARAM lParam = 0);
  1979.  
  1980.     BOOL SendNotifyMessage(UINT message, WPARAM wParam, LPARAM lParam);
  1981.     BOOL SendChildNotifyLastMsg(LRESULT* pResult = NULL);
  1982.  
  1983. // Message processing for modeless dialog-like windows
  1984.     BOOL IsDialogMessage(LPMSG lpMsg);
  1985.  
  1986. // Window Text Functions
  1987.     void SetWindowText(LPCTSTR lpszString);
  1988.     int GetWindowText(LPTSTR lpszStringBuf, int nMaxCount) const;
  1989.     void GetWindowText(CString& rString) const;
  1990.     int GetWindowTextLength() const;
  1991.     void SetFont(CFont* pFont, BOOL bRedraw = TRUE);
  1992.     CFont* GetFont() const;
  1993.  
  1994. // CMenu Functions - non-Child windows only
  1995. #if defined(_WIN32_WCE)
  1996.     HMENU m_hMenu;
  1997. #endif // _WIN32_WCE
  1998.     CMenu* GetMenu() const;
  1999.     BOOL SetMenu(CMenu* pMenu);
  2000.  
  2001.     void DrawMenuBar();
  2002. WCE_DEL    CMenu* GetSystemMenu(BOOL bRevert) const;
  2003. WCE_DEL    BOOL HiliteMenuItem(CMenu* pMenu, UINT nIDHiliteItem, UINT nHilite);
  2004.  
  2005. // Window Size and Position Functions
  2006.     BOOL IsIconic() const;
  2007. WCE_DEL    BOOL IsZoomed() const;
  2008.     void MoveWindow(int x, int y, int nWidth, int nHeight,
  2009.                 BOOL bRepaint = TRUE);
  2010.     void MoveWindow(LPCRECT lpRect, BOOL bRepaint = TRUE);
  2011. WCE_DEL    int SetWindowRgn(HRGN hRgn, BOOL bRedraw);
  2012. WCE_DEL    int GetWindowRgn(HRGN hRgn) const;
  2013.  
  2014.     static AFX_DATA const CWnd wndTop; // SetWindowPos's pWndInsertAfter
  2015.     static AFX_DATA const CWnd wndBottom; // SetWindowPos's pWndInsertAfter
  2016.     static AFX_DATA const CWnd wndTopMost; // SetWindowPos pWndInsertAfter
  2017.     static AFX_DATA const CWnd wndNoTopMost; // SetWindowPos pWndInsertAfter
  2018.  
  2019.     BOOL SetWindowPos(const CWnd* pWndInsertAfter, int x, int y,
  2020.                 int cx, int cy, UINT nFlags);
  2021. WCE_DEL    UINT ArrangeIconicWindows();
  2022.     void BringWindowToTop();
  2023.     void GetWindowRect(LPRECT lpRect) const;
  2024.     void GetClientRect(LPRECT lpRect) const;
  2025.  
  2026. WCE_DEL    BOOL GetWindowPlacement(WINDOWPLACEMENT* lpwndpl) const;
  2027. WCE_DEL    BOOL SetWindowPlacement(const WINDOWPLACEMENT* lpwndpl);
  2028.  
  2029. // Coordinate Mapping Functions
  2030.     void ClientToScreen(LPPOINT lpPoint) const;
  2031.     void ClientToScreen(LPRECT lpRect) const;
  2032.     void ScreenToClient(LPPOINT lpPoint) const;
  2033.     void ScreenToClient(LPRECT lpRect) const;
  2034.     void MapWindowPoints(CWnd* pwndTo, LPPOINT lpPoint, UINT nCount) const;
  2035.     void MapWindowPoints(CWnd* pwndTo, LPRECT lpRect) const;
  2036.  
  2037. // Update/Painting Functions
  2038.     CDC* BeginPaint(LPPAINTSTRUCT lpPaint);
  2039.     void EndPaint(LPPAINTSTRUCT lpPaint);
  2040.     CDC* GetDC();
  2041.     CDC* GetWindowDC();
  2042.     int ReleaseDC(CDC* pDC);
  2043. #if !defined(_WIN32_WCE_NO_PRINTING)
  2044.     void Print(CDC* pDC, DWORD dwFlags) const;
  2045.     void PrintClient(CDC* pDC, DWORD dwFlags) const;
  2046. #endif // _WIN32_WCE_NO_PRINTING
  2047.  
  2048.     void UpdateWindow();
  2049.     void SetRedraw(BOOL bRedraw = TRUE);
  2050.     BOOL GetUpdateRect(LPRECT lpRect, BOOL bErase = FALSE);
  2051. WCE_DEL    int GetUpdateRgn(CRgn* pRgn, BOOL bErase = FALSE);
  2052.     void Invalidate(BOOL bErase = TRUE);
  2053.     void InvalidateRect(LPCRECT lpRect, BOOL bErase = TRUE);
  2054.     void InvalidateRgn(CRgn* pRgn, BOOL bErase = TRUE);
  2055.     void ValidateRect(LPCRECT lpRect);
  2056. WCE_DEL    void ValidateRgn(CRgn* pRgn);
  2057.     BOOL ShowWindow(int nCmdShow);
  2058.     BOOL IsWindowVisible() const;
  2059. WCE_DEL    void ShowOwnedPopups(BOOL bShow = TRUE);
  2060.  
  2061. WCE_DEL    BOOL LockWindowUpdate();    // for backward compatibility
  2062. WCE_DEL    void UnlockWindowUpdate();
  2063.     BOOL RedrawWindow(LPCRECT lpRectUpdate = NULL,
  2064.         CRgn* prgnUpdate = NULL,
  2065.                 UINT flags = WCE_IF(0,RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE));
  2066. WCE_DEL    BOOL EnableScrollBar(int nSBFlags, UINT nArrowFlags = ESB_ENABLE_BOTH);
  2067.  
  2068. // Timer Functions
  2069.     UINT SetTimer(UINT nIDEvent, UINT nElapse,
  2070.         void (CALLBACK* lpfnTimer)(HWND, UINT, UINT, DWORD));
  2071.     BOOL KillTimer(int nIDEvent);
  2072.  
  2073. #if !defined(_WIN32_WCE_NO_TOOLTIPS)
  2074. // ToolTip Functions
  2075.     BOOL EnableToolTips(BOOL bEnable = TRUE);
  2076.     BOOL EnableTrackingToolTips(BOOL bEnable = TRUE);
  2077.     static void PASCAL CancelToolTips(BOOL bKeys = FALSE);
  2078.     void FilterToolTipMessage(MSG* pMsg);
  2079.  
  2080.     // for command hit testing (used for automatic tooltips)
  2081.     virtual int OnToolHitTest(CPoint point, TOOLINFO* pTI) const;
  2082. #endif // _WIN32_WCE_NO_TOOLTIPS
  2083.  
  2084. // Window State Functions
  2085.     BOOL IsWindowEnabled() const;
  2086.     BOOL EnableWindow(BOOL bEnable = TRUE);
  2087.  
  2088.     // the active window applies only to top-level (frame windows)
  2089.     static CWnd* PASCAL GetActiveWindow();
  2090.     CWnd* SetActiveWindow();
  2091.  
  2092.     // the foreground window applies only to top-level windows (frame windows)
  2093.     BOOL SetForegroundWindow();
  2094.     static CWnd* PASCAL GetForegroundWindow();
  2095.  
  2096.     // capture and focus apply to all windows
  2097.     static CWnd* PASCAL GetCapture();
  2098.     CWnd* SetCapture();
  2099.     static CWnd* PASCAL GetFocus();
  2100.     CWnd* SetFocus();
  2101.  
  2102.     static CWnd* PASCAL GetDesktopWindow();
  2103.  
  2104. // Obsolete and non-portable APIs - not recommended for new code
  2105. WCE_DEL    void CloseWindow();
  2106. WCE_DEL    BOOL OpenIcon();
  2107.  
  2108. // Dialog-Box Item Functions
  2109. // (NOTE: Dialog-Box Items/Controls are not necessarily in dialog boxes!)
  2110.     void CheckDlgButton(int nIDButton, UINT nCheck);
  2111.     void CheckRadioButton(int nIDFirstButton, int nIDLastButton,
  2112.                     int nIDCheckButton);
  2113.     int GetCheckedRadioButton(int nIDFirstButton, int nIDLastButton);
  2114. WCE_DEL    int DlgDirList(LPTSTR lpPathSpec, int nIDListBox,
  2115. WCE_DEL                    int nIDStaticPath, UINT nFileType);
  2116. WCE_DEL    int DlgDirListComboBox(LPTSTR lpPathSpec, int nIDComboBox,
  2117. WCE_DEL                    int nIDStaticPath, UINT nFileType);
  2118. WCE_DEL    BOOL DlgDirSelect(LPTSTR lpString, int nIDListBox);
  2119. WCE_DEL    BOOL DlgDirSelectComboBox(LPTSTR lpString, int nIDComboBox);
  2120.  
  2121.     UINT GetDlgItemInt(int nID, BOOL* lpTrans = NULL,
  2122.                     BOOL bSigned = TRUE) const;
  2123.     int GetDlgItemText(int nID, LPTSTR lpStr, int nMaxCount) const;
  2124.     int GetDlgItemText(int nID, CString& rString) const;
  2125.     CWnd* GetNextDlgGroupItem(CWnd* pWndCtl, BOOL bPrevious = FALSE) const;
  2126.  
  2127.     CWnd* GetNextDlgTabItem(CWnd* pWndCtl, BOOL bPrevious = FALSE) const;
  2128.     UINT IsDlgButtonChecked(int nIDButton) const;
  2129.     LRESULT SendDlgItemMessage(int nID, UINT message,
  2130.                     WPARAM wParam = 0, LPARAM lParam = 0);
  2131.     void SetDlgItemInt(int nID, UINT nValue, BOOL bSigned = TRUE);
  2132.     void SetDlgItemText(int nID, LPCTSTR lpszString);
  2133.  
  2134. // Scrolling Functions
  2135.     int GetScrollPos(int nBar) const;
  2136.     void GetScrollRange(int nBar, LPINT lpMinPos, LPINT lpMaxPos) const;
  2137.     void ScrollWindow(int xAmount, int yAmount,
  2138.                     LPCRECT lpRect = NULL,
  2139.                     LPCRECT lpClipRect = NULL);
  2140.     int SetScrollPos(int nBar, int nPos, BOOL bRedraw = TRUE);
  2141.     void SetScrollRange(int nBar, int nMinPos, int nMaxPos,
  2142.             BOOL bRedraw = TRUE);
  2143.     void ShowScrollBar(UINT nBar, BOOL bShow = TRUE);
  2144.     void EnableScrollBarCtrl(int nBar, BOOL bEnable = TRUE);
  2145.     virtual CScrollBar* GetScrollBarCtrl(int nBar) const;
  2146.             // return sibling scrollbar control (or NULL if none)
  2147.  
  2148.     int ScrollWindowEx(int dx, int dy,
  2149.                 LPCRECT lpRectScroll, LPCRECT lpRectClip,
  2150.                 CRgn* prgnUpdate, LPRECT lpRectUpdate, UINT flags);
  2151.     BOOL SetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo,
  2152.         BOOL bRedraw = TRUE);
  2153.     BOOL GetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo, UINT nMask = SIF_ALL);
  2154.     int GetScrollLimit(int nBar);
  2155.  
  2156. // Window Access Functions
  2157.     CWnd* ChildWindowFromPoint(POINT point) const;
  2158.     CWnd* ChildWindowFromPoint(POINT point, UINT nFlags) const;
  2159.     static CWnd* PASCAL FindWindow(LPCTSTR lpszClassName, LPCTSTR lpszWindowName);
  2160.     CWnd* GetNextWindow(UINT nFlag = GW_HWNDNEXT) const;
  2161.     CWnd* GetTopWindow() const;
  2162.  
  2163.     CWnd* GetWindow(UINT nCmd) const;
  2164.     CWnd* GetLastActivePopup() const;
  2165.  
  2166.     BOOL IsChild(const CWnd* pWnd) const;
  2167.     CWnd* GetParent() const;
  2168.     CWnd* SetParent(CWnd* pWndNewParent);
  2169.     static CWnd* PASCAL WindowFromPoint(POINT point);
  2170.  
  2171. // Alert Functions
  2172. WCE_DEL    BOOL FlashWindow(BOOL bInvert);
  2173.     int MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption = NULL,
  2174.             UINT nType = MB_OK);
  2175.  
  2176. // Clipboard Functions
  2177. WCE_DEL    BOOL ChangeClipboardChain(HWND hWndNext);
  2178. WCE_DEL    HWND SetClipboardViewer();
  2179.     BOOL OpenClipboard();
  2180.     static CWnd* PASCAL GetClipboardOwner();
  2181. WCE_DEL    static CWnd* PASCAL GetClipboardViewer();
  2182.     static CWnd* PASCAL GetOpenClipboardWindow();
  2183.  
  2184. // Caret Functions
  2185. WCE_DEL    void CreateCaret(CBitmap* pBitmap);
  2186.     void CreateSolidCaret(int nWidth, int nHeight);
  2187. WCE_DEL    void CreateGrayCaret(int nWidth, int nHeight);
  2188.     static CPoint PASCAL GetCaretPos();
  2189.     static void PASCAL SetCaretPos(POINT point);
  2190.     void HideCaret();
  2191.     void ShowCaret();
  2192.  
  2193. // Shell Interaction Functions
  2194. WCE_DEL    void DragAcceptFiles(BOOL bAccept = TRUE);
  2195.  
  2196. // Icon Functions
  2197.     HICON SetIcon(HICON hIcon, BOOL bBigIcon);
  2198.     HICON GetIcon(BOOL bBigIcon) const;
  2199.  
  2200. // Context Help Functions
  2201. WCE_DEL BOOL SetWindowContextHelpId(DWORD dwContextHelpId);
  2202. WCE_DEL DWORD GetWindowContextHelpId() const;
  2203.  
  2204. // Dialog Data support
  2205. public:
  2206.     BOOL UpdateData(BOOL bSaveAndValidate = TRUE);
  2207.             // data wnd must be same type as this
  2208.  
  2209. // Help Command Handlers
  2210.     afx_msg void OnHelp();          // F1 (uses current context)
  2211. WCE_DEL    afx_msg void OnHelpIndex();     // ID_HELP_INDEX
  2212. WCE_DEL    afx_msg void OnHelpFinder();    // ID_HELP_FINDER, ID_DEFAULT_HELP
  2213. WCE_DEL    afx_msg void OnHelpUsing();     // ID_HELP_USING
  2214.     virtual void WinHelp(DWORD dwData, UINT nCmd = WCE_IF(0,HELP_HELPFILE));
  2215.  
  2216. // Layout and other functions
  2217. public:
  2218.     enum RepositionFlags
  2219.         { reposDefault = 0, reposQuery = 1, reposExtra = 2 };
  2220.     void RepositionBars(UINT nIDFirst, UINT nIDLast, UINT nIDLeftOver,
  2221.         UINT nFlag = reposDefault, LPRECT lpRectParam = NULL,
  2222.         LPCRECT lpRectClient = NULL, BOOL bStretch = TRUE);
  2223.  
  2224.     // dialog support
  2225.     void UpdateDialogControls(CCmdTarget* pTarget, BOOL bDisableIfNoHndler);
  2226.     void CenterWindow(CWnd* pAlternateOwner = NULL);
  2227.     int RunModalLoop(DWORD dwFlags = 0);
  2228.     virtual BOOL ContinueModal();
  2229.     virtual void EndModalLoop(int nResult);
  2230.  
  2231. #ifndef _AFX_NO_OCC_SUPPORT
  2232. // OLE control wrapper functions
  2233.     void AFX_CDECL InvokeHelper(DISPID dwDispID, WORD wFlags,
  2234.         VARTYPE vtRet, void* pvRet, const BYTE* pbParamInfo, ...);
  2235.     void AFX_CDECL SetProperty(DISPID dwDispID, VARTYPE vtProp, ...);
  2236.     void GetProperty(DISPID dwDispID, VARTYPE vtProp, void* pvProp) const;
  2237. WCE_DEL    IUnknown* GetDSCCursor();
  2238.     void BindDefaultProperty(DISPID dwDispID, VARTYPE vtProp, LPCTSTR szFieldName, CWnd* pDSCWnd);
  2239.     void BindProperty(DISPID dwDispId, CWnd* pWndDSC);
  2240. #endif
  2241.  
  2242. // Window-Management message handler member functions
  2243. protected:
  2244.     virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
  2245.     virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  2246.  
  2247.     afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
  2248. WCE_DEL    afx_msg void OnActivateApp(BOOL bActive, HTASK hTask);
  2249.     afx_msg LRESULT OnActivateTopLevel(WPARAM, LPARAM);
  2250.     afx_msg void OnCancelMode();
  2251. WCE_DEL    afx_msg void OnChildActivate();
  2252.     afx_msg void OnClose();
  2253. WCE_DEL    afx_msg void OnContextMenu(CWnd* pWnd, CPoint pos);
  2254.     afx_msg BOOL OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct);
  2255. WCE_INS public: // WinCE: we simulate OnCreate calls for dialog boxes, so we need global access
  2256.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  2257. WCE_INS protected:
  2258.  
  2259.     afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  2260.  
  2261.     afx_msg void OnDestroy();
  2262.     afx_msg void OnEnable(BOOL bEnable);
  2263. WCE_DEL    afx_msg void OnEndSession(BOOL bEnding);
  2264. WCE_DEL afx_msg void OnEnterIdle(UINT nWhy, CWnd* pWho);
  2265.     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  2266. WCE_DEL    afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
  2267.     afx_msg BOOL OnHelpInfo(HELPINFO* lpHelpInfo);
  2268. WCE_DEL    afx_msg void OnIconEraseBkgnd(CDC* pDC);
  2269.     afx_msg void OnKillFocus(CWnd* pNewWnd);
  2270.     afx_msg LRESULT OnMenuChar(UINT nChar, UINT nFlags, CMenu* pMenu);
  2271. WCE_DEL    afx_msg void OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu);
  2272.     afx_msg void OnMove(int x, int y);
  2273.     afx_msg void OnPaint();
  2274. WCE_DEL    afx_msg void OnParentNotify(UINT message, LPARAM lParam);
  2275.     afx_msg HCURSOR OnQueryDragIcon();
  2276. WCE_DEL    afx_msg BOOL OnQueryEndSession();
  2277.     afx_msg BOOL OnQueryNewPalette();
  2278. WCE_DEL    afx_msg BOOL OnQueryOpen();
  2279.     afx_msg void OnSetFocus(CWnd* pOldWnd);
  2280.     afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
  2281.     afx_msg void OnSize(UINT nType, int cx, int cy);
  2282. WCE_DEL    afx_msg void OnTCard(UINT idAction, DWORD dwActionData);
  2283. WCE_DEL afx_msg void OnWindowPosChanging(WINDOWPOS* lpwndpos);
  2284.     afx_msg void OnWindowPosChanged(WINDOWPOS* lpwndpos);
  2285.  
  2286. // Nonclient-Area message handler member functions
  2287. WCE_DEL    afx_msg BOOL OnNcActivate(BOOL bActive);
  2288. WCE_DEL    afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp);
  2289. WCE_DEL    afx_msg BOOL OnNcCreate(LPCREATESTRUCT lpCreateStruct);
  2290.         afx_msg void OnNcDestroy();
  2291. WCE_DEL    afx_msg UINT OnNcHitTest(CPoint point);
  2292. WCE_DEL    afx_msg void OnNcLButtonDblClk(UINT nHitTest, CPoint point);
  2293. WCE_DEL    afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
  2294. WCE_DEL    afx_msg void OnNcLButtonUp(UINT nHitTest, CPoint point);
  2295. WCE_DEL    afx_msg void OnNcMButtonDblClk(UINT nHitTest, CPoint point);
  2296. WCE_DEL    afx_msg void OnNcMButtonDown(UINT nHitTest, CPoint point);
  2297. WCE_DEL    afx_msg void OnNcMButtonUp(UINT nHitTest, CPoint point);
  2298. WCE_DEL    afx_msg void OnNcMouseMove(UINT nHitTest, CPoint point);
  2299. WCE_DEL    afx_msg void OnNcPaint();
  2300. WCE_DEL    afx_msg void OnNcRButtonDblClk(UINT nHitTest, CPoint point);
  2301. WCE_DEL    afx_msg void OnNcRButtonDown(UINT nHitTest, CPoint point);
  2302. WCE_DEL    afx_msg void OnNcRButtonUp(UINT nHitTest, CPoint point);
  2303.  
  2304. // System message handler member functions
  2305. WCE_DEL    afx_msg void OnDropFiles(HDROP hDropInfo);
  2306. WCE_DEL    afx_msg void OnPaletteIsChanging(CWnd* pRealizeWnd);
  2307.     afx_msg void OnSysChar(UINT nChar, UINT nRepCnt, UINT nFlags);
  2308.     afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
  2309.     afx_msg void OnSysDeadChar(UINT nChar, UINT nRepCnt, UINT nFlags);
  2310.     afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  2311.     afx_msg void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
  2312. WCE_DEL    afx_msg void OnCompacting(UINT nCpuTime);
  2313. WCE_DEL afx_msg void OnDevModeChange(LPTSTR lpDeviceName);
  2314.     afx_msg void OnFontChange();
  2315.     afx_msg void OnPaletteChanged(CWnd* pFocusWnd);
  2316. WCE_DEL    afx_msg void OnSpoolerStatus(UINT nStatus, UINT nJobs);
  2317.     afx_msg void OnSysColorChange();
  2318. WCE_DEL    afx_msg void OnTimeChange();
  2319.     afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
  2320.     afx_msg void OnWinIniChange(LPCTSTR lpszSection);
  2321.  
  2322. // Input message handler member functions
  2323.     afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
  2324.     afx_msg void OnDeadChar(UINT nChar, UINT nRepCnt, UINT nFlags);
  2325.     afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  2326.     afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  2327.     afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  2328.     afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
  2329.     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  2330.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  2331.     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  2332.     afx_msg void OnMButtonDblClk(UINT nFlags, CPoint point);
  2333.     afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
  2334.     afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
  2335. WCE_DEL    afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
  2336.     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  2337. WCE_DEL    afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
  2338. WCE_DEL    afx_msg LRESULT OnRegisteredMouseWheel(WPARAM wParam, LPARAM lParam);
  2339.     afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
  2340.     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
  2341.     afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
  2342. #if !defined(_WIN32_WCE_NO_CURSOR)
  2343.     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  2344. #endif // _WIN32_WCE_NO_CURSOR
  2345.     afx_msg void OnTimer(UINT nIDEvent);
  2346.  
  2347. // Initialization message handler member functions
  2348. WCE_DEL    afx_msg void OnInitMenu(CMenu* pMenu);
  2349.     afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
  2350.  
  2351. // Clipboard message handler member functions
  2352. WCE_DEL    afx_msg void OnAskCbFormatName(UINT nMaxCount, LPTSTR lpszString);
  2353. WCE_DEL    afx_msg void OnChangeCbChain(HWND hWndRemove, HWND hWndAfter);
  2354.     afx_msg void OnDestroyClipboard();
  2355. WCE_DEL    afx_msg void OnDrawClipboard();
  2356. WCE_DEL    afx_msg void OnHScrollClipboard(CWnd* pClipAppWnd, UINT nSBCode, UINT nPos);
  2357. WCE_DEL    afx_msg void OnPaintClipboard(CWnd* pClipAppWnd, HGLOBAL hPaintStruct);
  2358.     afx_msg void OnRenderAllFormats();
  2359.     afx_msg void OnRenderFormat(UINT nFormat);
  2360. WCE_DEL    afx_msg void OnSizeClipboard(CWnd* pClipAppWnd, HGLOBAL hRect);
  2361. WCE_DEL    afx_msg void OnVScrollClipboard(CWnd* pClipAppWnd, UINT nSBCode, UINT nPos);
  2362.  
  2363. // Control message handler member functions
  2364.     afx_msg int OnCompareItem(int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct);
  2365.     afx_msg void OnDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct);
  2366.     afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
  2367.     afx_msg UINT OnGetDlgCode();
  2368.     afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
  2369.     afx_msg int OnCharToItem(UINT nChar, CListBox* pListBox, UINT nIndex);
  2370.     afx_msg int OnVKeyToItem(UINT nKey, CListBox* pListBox, UINT nIndex);
  2371.  
  2372. // MDI message handler member functions
  2373. WCE_DEL afx_msg void OnMDIActivate(BOOL bActivate,
  2374. WCE_DEL        CWnd* pActivateWnd, CWnd* pDeactivateWnd);
  2375.  
  2376. // Menu loop notification messages
  2377. WCE_DEL    afx_msg void OnEnterMenuLoop(BOOL bIsTrackPopupMenu);
  2378. WCE_DEL    afx_msg void OnExitMenuLoop(BOOL bIsTrackPopupMenu);
  2379.  
  2380. // Win4 messages
  2381.     afx_msg void OnStyleChanged(int nStyleType, LPSTYLESTRUCT lpStyleStruct);
  2382. WCE_DEL    afx_msg void OnStyleChanging(int nStyleType, LPSTYLESTRUCT lpStyleStruct);
  2383. WCE_DEL    afx_msg void OnSizing(UINT nSide, LPRECT lpRect);
  2384. WCE_DEL    afx_msg void OnMoving(UINT nSide, LPRECT lpRect);
  2385.     afx_msg void OnCaptureChanged(CWnd* pWnd);
  2386. WCE_DEL    afx_msg BOOL OnDeviceChange(UINT nEventType, DWORD dwData);
  2387.  
  2388. // Overridables and other helpers (for implementation of derived classes)
  2389. protected:
  2390.     // for deriving from a standard control
  2391.     virtual WNDPROC* GetSuperWndProcAddr();
  2392.  
  2393.     // for dialog data exchange and validation
  2394.     virtual void DoDataExchange(CDataExchange* pDX);
  2395.  
  2396. public:
  2397.     // for modality
  2398.     virtual void BeginModalState();
  2399.     virtual void EndModalState();
  2400.  
  2401.     // for translating Windows messages in main message pump
  2402.     virtual BOOL PreTranslateMessage(MSG* pMsg);
  2403.  
  2404. #ifndef _AFX_NO_OCC_SUPPORT
  2405.     // for ambient properties exposed to contained OLE controls
  2406.     virtual BOOL OnAmbientProperty(COleControlSite* pSite, DISPID dispid,
  2407.         VARIANT* pvar);
  2408. #endif
  2409.  
  2410. protected:
  2411.     // for processing Windows messages
  2412.     virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  2413.     virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  2414.  
  2415.     // for handling default processing
  2416.     LRESULT Default();
  2417.     virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  2418.  
  2419.     // for custom cleanup after WM_NCDESTROY
  2420.     virtual void PostNcDestroy();
  2421.  
  2422.     // for notifications from parent
  2423.     virtual BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  2424.         // return TRUE if parent should not process this message
  2425.     BOOL ReflectChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  2426.     static BOOL PASCAL ReflectLastMsg(HWND hWndChild, LRESULT* pResult = NULL);
  2427.  
  2428. // Implementation
  2429. public:
  2430.     virtual ~CWnd();
  2431.     virtual BOOL CheckAutoCenter();
  2432. #ifdef _DEBUG
  2433.     virtual void AssertValid() const;
  2434.     virtual void Dump(CDumpContext& dc) const;
  2435. #endif
  2436. #ifndef _AFX_NO_CTL3D_SUPPORT
  2437.     // 3D support (these APIs will be obsolete with next version of Windows)
  2438.     BOOL SubclassCtl3d(int nControlType = -1);
  2439.         // see CTL3D.H for list of control types
  2440.     BOOL SubclassDlg3d(DWORD dwMask = 0xFFFF /*CTL3D_ALL*/);
  2441.         // see CTL3D.H for list of mask values
  2442. #endif
  2443.     static BOOL PASCAL GrayCtlColor(HDC hDC, HWND hWnd, UINT nCtlColor,
  2444.         HBRUSH hbrGray, COLORREF clrText);
  2445. #ifndef _AFX_NO_GRAYDLG_SUPPORT
  2446.     HBRUSH OnGrayCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  2447. #endif
  2448.  
  2449.     // helper routines for implementation
  2450. WCE_DEL    BOOL HandleFloatingSysCommand(UINT nID, LPARAM lParam);
  2451.     BOOL IsTopParentActive() const;
  2452.     void ActivateTopParent();
  2453.     static BOOL PASCAL WalkPreTranslateTree(HWND hWndStop, MSG* pMsg);
  2454.     static CWnd* PASCAL GetDescendantWindow(HWND hWnd, int nID,
  2455.         BOOL bOnlyPerm);
  2456.     static void PASCAL SendMessageToDescendants(HWND hWnd, UINT message,
  2457.         WPARAM wParam, LPARAM lParam, BOOL bDeep, BOOL bOnlyPerm);
  2458.     virtual BOOL IsFrameWnd() const; // IsKindOf(RUNTIME_CLASS(CFrameWnd)))
  2459.     virtual void OnFinalRelease();
  2460.     BOOL PreTranslateInput(LPMSG lpMsg);
  2461.     static BOOL PASCAL ModifyStyle(HWND hWnd, DWORD dwRemove, DWORD dwAdd,
  2462.         UINT nFlags);
  2463.     static BOOL PASCAL ModifyStyleEx(HWND hWnd, DWORD dwRemove, DWORD dwAdd,
  2464.         UINT nFlags);
  2465. #if !defined(_WIN32_WCE_NO_TOOLTIPS)
  2466.     static void PASCAL _FilterToolTipMessage(MSG* pMsg, CWnd* pWnd);
  2467.     BOOL _EnableToolTips(BOOL bEnable, UINT nFlag);
  2468. #endif // _WIN32_WCE_NO_TOOLTIPS
  2469.     static HWND PASCAL GetSafeOwner_(HWND hWnd, HWND* pWndTop);
  2470.  
  2471. public:
  2472.     HWND m_hWndOwner;   // implementation of SetOwner and GetOwner
  2473.     UINT m_nFlags;      // see WF_ flags above
  2474.  
  2475. protected:
  2476.     WNDPROC m_pfnSuper; // for subclassing of controls
  2477.     static const UINT m_nMsgDragList;
  2478.     int m_nModalResult; // for return values from CWnd::RunModalLoop
  2479.  
  2480. #if !defined(_WIN32_WCE_NO_OLE)
  2481.     COleDropTarget* m_pDropTarget;  // for automatic cleanup of drop target
  2482.     friend class COleDropTarget;
  2483. #endif // _WIN32_WCE_NO_OLE
  2484.     friend class CFrameWnd;
  2485.  
  2486.     // for creating dialogs and dialog-like windows
  2487.     BOOL CreateDlg(LPCTSTR lpszTemplateName, CWnd* pParentWnd);
  2488.     BOOL CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd);
  2489.     BOOL CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd,
  2490.         HINSTANCE hInst);
  2491.  
  2492. #ifndef _AFX_NO_OCC_SUPPORT
  2493.     COleControlContainer* m_pCtrlCont;  // for containing OLE controls
  2494.     COleControlSite* m_pCtrlSite;       // for wrapping an OLE control
  2495.     friend class COccManager;
  2496.     friend class COleControlSite;
  2497.     friend class COleControlContainer;
  2498.     BOOL InitControlContainer();
  2499.     virtual BOOL SetOccDialogInfo(struct _AFX_OCC_DIALOG_INFO* pOccDialogInfo);
  2500.     void AttachControlSite(CHandleMap* pMap);
  2501. public:
  2502.     void AttachControlSite(CWnd* pWndParent);
  2503. #endif
  2504.  
  2505. protected:
  2506.     // implementation of message dispatch/hooking
  2507.     friend LRESULT CALLBACK _AfxSendMsgHook(int, WPARAM, LPARAM);
  2508.     friend void AFXAPI _AfxStandardSubclass(HWND);
  2509.     friend LRESULT CALLBACK _AfxCbtFilterHook(int, WPARAM, LPARAM);
  2510.     friend LRESULT AFXAPI AfxCallWndProc(CWnd*, HWND, UINT, WPARAM, LPARAM);
  2511.  
  2512.     // standard message implementation
  2513.     afx_msg LRESULT OnNTCtlColor(WPARAM wParam, LPARAM lParam);
  2514. #ifndef _AFX_NO_CTL3D_SUPPORT
  2515.     afx_msg LRESULT OnQuery3dControls(WPARAM, LPARAM);
  2516. #endif
  2517.     afx_msg LRESULT OnDisplayChange(WPARAM, LPARAM);
  2518. WCE_DEL    afx_msg LRESULT OnDragList(WPARAM, LPARAM);
  2519.  
  2520.     //{{AFX_MSG(CWnd)
  2521.     //}}AFX_MSG
  2522.     DECLARE_MESSAGE_MAP()
  2523.  
  2524. private:
  2525.     CWnd(HWND hWnd);    // just for special initialization
  2526. };
  2527.  
  2528. // helpers for registering your own WNDCLASSes
  2529. LPCTSTR AFXAPI AfxRegisterWndClass(UINT nClassStyle,
  2530.     HCURSOR hCursor = 0, HBRUSH hbrBackground = 0, HICON hIcon = 0);
  2531.  
  2532. BOOL AFXAPI AfxRegisterClass(WNDCLASS* lpWndClass);
  2533.  
  2534. // helper to initialize rich edit control
  2535. WCE_DEL BOOL AFXAPI AfxInitRichEdit();
  2536.  
  2537. // Implementation
  2538. LRESULT CALLBACK AfxWndProc(HWND, UINT, WPARAM, LPARAM);
  2539.  
  2540. WNDPROC AFXAPI AfxGetAfxWndProc();
  2541. #define AfxWndProc (*AfxGetAfxWndProc())
  2542.  
  2543. typedef void (AFX_MSG_CALL CWnd::*AFX_PMSGW)(void);
  2544.     // like 'AFX_PMSG' but for CWnd derived classes only
  2545.  
  2546. typedef void (AFX_MSG_CALL CWinThread::*AFX_PMSGT)(void);
  2547.     // like 'AFX_PMSG' but for CWinThread-derived classes only
  2548.  
  2549. /////////////////////////////////////////////////////////////////////////////
  2550. // CDialog - a modal or modeless dialog
  2551.  
  2552. class CDialog : public CWnd
  2553. {
  2554.     DECLARE_DYNAMIC(CDialog)
  2555.  
  2556.     // Modeless construct
  2557. public:
  2558.     CDialog();
  2559.  
  2560.     BOOL Create(LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL);
  2561.     BOOL Create(UINT nIDTemplate, CWnd* pParentWnd = NULL);
  2562.     BOOL CreateIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd = NULL,
  2563.         void* lpDialogInit = NULL);
  2564.     BOOL CreateIndirect(HGLOBAL hDialogTemplate, CWnd* pParentWnd = NULL);
  2565.  
  2566.     // Modal construct
  2567. public:
  2568.     CDialog(LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL);
  2569.     CDialog(UINT nIDTemplate, CWnd* pParentWnd = NULL);
  2570.     BOOL InitModalIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd = NULL,
  2571.         void* lpDialogInit = NULL);
  2572.     BOOL InitModalIndirect(HGLOBAL hDialogTemplate, CWnd* pParentWnd = NULL);
  2573.  
  2574. // Attributes
  2575. public:
  2576.     void MapDialogRect(LPRECT lpRect) const;
  2577.     void SetHelpID(UINT nIDR);
  2578.  
  2579. // Operations
  2580. public:
  2581.     // modal processing
  2582.     virtual int DoModal();
  2583.  
  2584.     // support for passing on tab control - use 'PostMessage' if needed
  2585.     void NextDlgCtrl() const;
  2586.     void PrevDlgCtrl() const;
  2587.     void GotoDlgCtrl(CWnd* pWndCtrl);
  2588.  
  2589.     // default button access
  2590.     void SetDefID(UINT nID);
  2591.     DWORD GetDefID() const;
  2592.  
  2593.     // termination
  2594.     void EndDialog(int nResult);
  2595.  
  2596. // Overridables (special message map entries)
  2597.     virtual BOOL OnInitDialog();
  2598.     virtual void OnSetFont(CFont* pFont);
  2599. protected:
  2600.     virtual void OnOK();
  2601.     virtual void OnCancel();
  2602.  
  2603. // Implementation
  2604. public:
  2605.     virtual ~CDialog();
  2606. #ifdef _DEBUG
  2607.     virtual void AssertValid() const;
  2608.     virtual void Dump(CDumpContext& dc) const;
  2609. #endif
  2610.     virtual BOOL PreTranslateMessage(MSG* pMsg);
  2611.     virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,
  2612.         AFX_CMDHANDLERINFO* pHandlerInfo);
  2613.     virtual BOOL CheckAutoCenter();
  2614.  
  2615. protected:
  2616.     UINT m_nIDHelp;                 // Help ID (0 for none, see HID_BASE_RESOURCE)
  2617.  
  2618.     // parameters for 'DoModal'
  2619.     LPCTSTR m_lpszTemplateName;     // name or MAKEINTRESOURCE
  2620.     HGLOBAL m_hDialogTemplate;      // indirect (m_lpDialogTemplate == NULL)
  2621.     LPCDLGTEMPLATE m_lpDialogTemplate;  // indirect if (m_lpszTemplateName == NULL)
  2622.     void* m_lpDialogInit;           // DLGINIT resource data
  2623.     CWnd* m_pParentWnd;             // parent/owner window
  2624.     HWND m_hWndTop;                 // top level parent window (may be disabled)
  2625.  
  2626. #ifndef _AFX_NO_OCC_SUPPORT
  2627.     _AFX_OCC_DIALOG_INFO* m_pOccDialogInfo;
  2628.     virtual BOOL SetOccDialogInfo(_AFX_OCC_DIALOG_INFO* pOccDialogInfo);
  2629. #endif
  2630.     virtual void PreInitDialog();
  2631.  
  2632.     // implementation helpers
  2633.     HWND PreModal();
  2634.     void PostModal();
  2635.  
  2636.     BOOL CreateIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd,
  2637.         void* lpDialogInit, HINSTANCE hInst);
  2638.     BOOL CreateIndirect(HGLOBAL hDialogTemplate, CWnd* pParentWnd,
  2639.         HINSTANCE hInst);
  2640.  
  2641. protected:
  2642.     //{{AFX_MSG(CDialog)
  2643.     afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
  2644.     afx_msg LRESULT OnHelpHitTest(WPARAM wParam, LPARAM lParam);
  2645.     afx_msg LRESULT HandleInitDialog(WPARAM, LPARAM);
  2646.     afx_msg LRESULT HandleSetFont(WPARAM, LPARAM);
  2647.     //}}AFX_MSG
  2648. #ifndef _AFX_NO_GRAYDLG_SUPPORT
  2649.     afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  2650. #endif
  2651.     DECLARE_MESSAGE_MAP()
  2652. };
  2653.  
  2654. // all CModalDialog functionality is now in CDialog
  2655. #define CModalDialog    CDialog
  2656.  
  2657. /////////////////////////////////////////////////////////////////////////////
  2658. // Standard Windows controls
  2659.  
  2660. class CStatic : public CWnd
  2661. {
  2662.     DECLARE_DYNAMIC(CStatic)
  2663.  
  2664. // Constructors
  2665. public:
  2666.     CStatic();
  2667.     BOOL Create(LPCTSTR lpszText, DWORD dwStyle,
  2668.                 const RECT& rect, CWnd* pParentWnd, UINT nID = 0xffff);
  2669.  
  2670. // Operations
  2671.     HICON SetIcon(HICON hIcon);
  2672.     HICON GetIcon() const;
  2673.  
  2674. #if (WINVER >= 0x400)
  2675. WCE_DEL    HENHMETAFILE SetEnhMetaFile(HENHMETAFILE hMetaFile);
  2676. WCE_DEL    HENHMETAFILE GetEnhMetaFile() const;
  2677.     HBITMAP SetBitmap(HBITMAP hBitmap);
  2678.     HBITMAP GetBitmap() const;
  2679. WCE_DEL HCURSOR SetCursor(HCURSOR hCursor);
  2680. WCE_DEL    HCURSOR GetCursor();
  2681. #endif
  2682.  
  2683. // Implementation
  2684. public:
  2685.     virtual ~CStatic();
  2686. };
  2687.  
  2688. class CButton : public CWnd
  2689. {
  2690.     DECLARE_DYNAMIC(CButton)
  2691.  
  2692. // Constructors
  2693. public:
  2694.     CButton();
  2695.     BOOL Create(LPCTSTR lpszCaption, DWORD dwStyle,
  2696.                 const RECT& rect, CWnd* pParentWnd, UINT nID);
  2697.  
  2698. // Attributes
  2699.     UINT GetState() const;
  2700.     void SetState(BOOL bHighlight);
  2701.     int GetCheck() const;
  2702.     void SetCheck(int nCheck);
  2703.     UINT GetButtonStyle() const;
  2704.     void SetButtonStyle(UINT nStyle, BOOL bRedraw = TRUE);
  2705.  
  2706. #if (WINVER >= 0x400)
  2707. WCE_DEL HICON SetIcon(HICON hIcon);
  2708. WCE_DEL HICON GetIcon() const;
  2709. WCE_DEL HBITMAP SetBitmap(HBITMAP hBitmap);
  2710. WCE_DEL HBITMAP GetBitmap() const;
  2711. WCE_DEL HCURSOR SetCursor(HCURSOR hCursor);
  2712. WCE_DEL    HCURSOR GetCursor();
  2713. #endif
  2714.  
  2715. // Overridables (for owner draw only)
  2716.     virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
  2717.  
  2718. // Implementation
  2719. public:
  2720.     virtual ~CButton();
  2721. protected:
  2722.     virtual BOOL OnChildNotify(UINT, WPARAM, LPARAM, LRESULT*);
  2723. };
  2724.  
  2725. class CListBox : public CWnd
  2726. {
  2727.     DECLARE_DYNAMIC(CListBox)
  2728.  
  2729. // Constructors
  2730. public:
  2731.     CListBox();
  2732.     BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
  2733.  
  2734. // Attributes
  2735.  
  2736.     // for entire listbox
  2737.     int GetCount() const;
  2738.     int GetHorizontalExtent() const;
  2739.     void SetHorizontalExtent(int cxExtent);
  2740.     int GetTopIndex() const;
  2741.     int SetTopIndex(int nIndex);
  2742.     LCID GetLocale() const;
  2743.     LCID SetLocale(LCID nNewLocale);
  2744. #if (WINVER >= 0x400)
  2745.     int InitStorage(int nItems, UINT nBytes);
  2746.     UINT ItemFromPoint(CPoint pt, BOOL& bOutside) const;
  2747. #endif
  2748.     // for single-selection listboxes
  2749.     int GetCurSel() const;
  2750.     int SetCurSel(int nSelect);
  2751.  
  2752.     // for multiple-selection listboxes
  2753.     int GetSel(int nIndex) const;           // also works for single-selection
  2754.     int SetSel(int nIndex, BOOL bSelect = TRUE);
  2755.     int GetSelCount() const;
  2756.     int GetSelItems(int nMaxItems, LPINT rgIndex) const;
  2757.     void SetAnchorIndex(int nIndex);
  2758.     int GetAnchorIndex() const;
  2759.  
  2760.     // for listbox items
  2761.     DWORD GetItemData(int nIndex) const;
  2762.     int SetItemData(int nIndex, DWORD dwItemData);
  2763.     void* GetItemDataPtr(int nIndex) const;
  2764.     int SetItemDataPtr(int nIndex, void* pData);
  2765.     int GetItemRect(int nIndex, LPRECT lpRect) const;
  2766.     int GetText(int nIndex, LPTSTR lpszBuffer) const;
  2767.     void GetText(int nIndex, CString& rString) const;
  2768.     int GetTextLen(int nIndex) const;
  2769.  
  2770.     // Settable only attributes
  2771.     void SetColumnWidth(int cxWidth);
  2772.     BOOL SetTabStops(int nTabStops, LPINT rgTabStops);
  2773.     void SetTabStops();
  2774.     BOOL SetTabStops(const int& cxEachStop);    // takes an 'int'
  2775.  
  2776.     int SetItemHeight(int nIndex, UINT cyItemHeight);
  2777.     int GetItemHeight(int nIndex) const;
  2778.     int FindStringExact(int nIndexStart, LPCTSTR lpszFind) const;
  2779.     int GetCaretIndex() const;
  2780.     int SetCaretIndex(int nIndex, BOOL bScroll = TRUE);
  2781.  
  2782. // Operations
  2783.     // manipulating listbox items
  2784.     int AddString(LPCTSTR lpszItem);
  2785.     int DeleteString(UINT nIndex);
  2786.     int InsertString(int nIndex, LPCTSTR lpszItem);
  2787.     void ResetContent();
  2788. WCE_DEL int Dir(UINT attr, LPCTSTR lpszWildCard);
  2789.  
  2790.     // selection helpers
  2791.     int FindString(int nStartAfter, LPCTSTR lpszItem) const;
  2792.     int SelectString(int nStartAfter, LPCTSTR lpszItem);
  2793.     int SelItemRange(BOOL bSelect, int nFirstItem, int nLastItem);
  2794.  
  2795. // Overridables (must override draw, measure and compare for owner draw)
  2796.     virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
  2797.     virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
  2798.     virtual int CompareItem(LPCOMPAREITEMSTRUCT lpCompareItemStruct);
  2799.     virtual void DeleteItem(LPDELETEITEMSTRUCT lpDeleteItemStruct);
  2800.     virtual int VKeyToItem(UINT nKey, UINT nIndex);
  2801.     virtual int CharToItem(UINT nKey, UINT nIndex);
  2802.  
  2803. // Implementation
  2804. public:
  2805.     virtual ~CListBox();
  2806. protected:
  2807.     virtual BOOL OnChildNotify(UINT, WPARAM, LPARAM, LRESULT*);
  2808. };
  2809.  
  2810. #if !defined(_WIN32_WCE)
  2811. class CCheckListBox : public CListBox
  2812. {
  2813.     DECLARE_DYNAMIC(CCheckListBox)
  2814.  
  2815. // Constructors
  2816. public:
  2817.     CCheckListBox();
  2818.     BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
  2819.  
  2820. // Attributes
  2821.     void SetCheckStyle(UINT nStyle);
  2822.     UINT GetCheckStyle();
  2823.     void SetCheck(int nIndex, int nCheck);
  2824.     int GetCheck(int nIndex);
  2825.     void Enable(int nIndex, BOOL bEnabled = TRUE);
  2826.     BOOL IsEnabled(int nIndex);
  2827.  
  2828.     virtual CRect OnGetCheckPosition(CRect rectItem, CRect rectCheckBox);
  2829.  
  2830. // Overridables (must override draw, measure and compare for owner draw)
  2831.     virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
  2832.     virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
  2833.  
  2834. // Implementation
  2835. protected:
  2836.     void PreDrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
  2837.     void PreMeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
  2838.     int PreCompareItem(LPCOMPAREITEMSTRUCT lpCompareItemStruct);
  2839.     void PreDeleteItem(LPDELETEITEMSTRUCT lpDeleteItemStruct);
  2840.  
  2841.     virtual BOOL OnChildNotify(UINT, WPARAM, LPARAM, LRESULT*);
  2842.  
  2843.    void SetSelectionCheck( int nCheck );
  2844.  
  2845. #ifdef _DEBUG
  2846.     virtual void PreSubclassWindow();
  2847. #endif
  2848.  
  2849.     int CalcMinimumItemHeight();
  2850.     void InvalidateCheck(int nIndex);
  2851.     void InvalidateItem(int nIndex);
  2852.     int CheckFromPoint(CPoint point, BOOL& bInCheck);
  2853.  
  2854.     int m_cyText;
  2855.     UINT m_nStyle;
  2856.  
  2857.     // Message map functions
  2858. protected:
  2859.     //{{AFX_MSG(CCheckListBox)
  2860.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  2861.     afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  2862.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  2863.     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  2864.     afx_msg LRESULT OnSetFont(WPARAM wParam, LPARAM lParam);
  2865.     afx_msg LRESULT OnLBAddString(WPARAM wParam, LPARAM lParam);
  2866.     afx_msg LRESULT OnLBFindString(WPARAM wParam, LPARAM lParam);
  2867.     afx_msg LRESULT OnLBFindStringExact(WPARAM wParam, LPARAM lParam);
  2868.     afx_msg LRESULT OnLBGetItemData(WPARAM wParam, LPARAM lParam);
  2869.     afx_msg LRESULT OnLBGetText(WPARAM wParam, LPARAM lParam);
  2870.     afx_msg LRESULT OnLBInsertString(WPARAM wParam, LPARAM lParam);
  2871.     afx_msg LRESULT OnLBSelectString(WPARAM wParam, LPARAM lParam);
  2872.     afx_msg LRESULT OnLBSetItemData(WPARAM wParam, LPARAM lParam);
  2873.     afx_msg LRESULT OnLBSetItemHeight(WPARAM wParam, LPARAM lParam);
  2874.     //}}AFX_MSG
  2875.     DECLARE_MESSAGE_MAP()
  2876. };
  2877. #endif // _WIN32_WCE
  2878.  
  2879. class CComboBox : public CWnd
  2880. {
  2881.     DECLARE_DYNAMIC(CComboBox)
  2882.  
  2883. // Constructors
  2884. public:
  2885.     CComboBox();
  2886.     BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
  2887.  
  2888. // Attributes
  2889.     // for entire combo box
  2890.     int GetCount() const;
  2891.     int GetCurSel() const;
  2892.     int SetCurSel(int nSelect);
  2893.     LCID GetLocale() const;
  2894.     LCID SetLocale(LCID nNewLocale);
  2895. // Win4
  2896.     int GetTopIndex() const;
  2897.     int SetTopIndex(int nIndex);
  2898.     int InitStorage(int nItems, UINT nBytes);
  2899.     void SetHorizontalExtent(UINT nExtent);
  2900.     UINT GetHorizontalExtent() const;
  2901.     int SetDroppedWidth(UINT nWidth);
  2902.     int GetDroppedWidth() const;
  2903.  
  2904.     // for edit control
  2905.     DWORD GetEditSel() const;
  2906.     BOOL LimitText(int nMaxChars);
  2907.     BOOL SetEditSel(int nStartChar, int nEndChar);
  2908.  
  2909.     // for combobox item
  2910.     DWORD GetItemData(int nIndex) const;
  2911.     int SetItemData(int nIndex, DWORD dwItemData);
  2912.     void* GetItemDataPtr(int nIndex) const;
  2913.     int SetItemDataPtr(int nIndex, void* pData);
  2914.     int GetLBText(int nIndex, LPTSTR lpszText) const;
  2915.     void GetLBText(int nIndex, CString& rString) const;
  2916.     int GetLBTextLen(int nIndex) const;
  2917.  
  2918.     int SetItemHeight(int nIndex, UINT cyItemHeight);
  2919.     int GetItemHeight(int nIndex) const;
  2920.     int FindStringExact(int nIndexStart, LPCTSTR lpszFind) const;
  2921.     int SetExtendedUI(BOOL bExtended = TRUE);
  2922.     BOOL GetExtendedUI() const;
  2923.     void GetDroppedControlRect(LPRECT lprect) const;
  2924.     BOOL GetDroppedState() const;
  2925.  
  2926. // Operations
  2927.     // for drop-down combo boxes
  2928.     void ShowDropDown(BOOL bShowIt = TRUE);
  2929.  
  2930.     // manipulating listbox items
  2931.     int AddString(LPCTSTR lpszString);
  2932.     int DeleteString(UINT nIndex);
  2933.     int InsertString(int nIndex, LPCTSTR lpszString);
  2934.     void ResetContent();
  2935. WCE_DEL int Dir(UINT attr, LPCTSTR lpszWildCard);
  2936.  
  2937.     // selection helpers
  2938.     int FindString(int nStartAfter, LPCTSTR lpszString) const;
  2939.     int SelectString(int nStartAfter, LPCTSTR lpszString);
  2940.  
  2941.     // Clipboard operations
  2942.     void Clear();
  2943.     void Copy();
  2944.     void Cut();
  2945.     void Paste();
  2946.  
  2947. // Overridables (must override draw, measure and compare for owner draw)
  2948.     virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
  2949.     virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
  2950.     virtual int CompareItem(LPCOMPAREITEMSTRUCT lpCompareItemStruct);
  2951.     virtual void DeleteItem(LPDELETEITEMSTRUCT lpDeleteItemStruct);
  2952.  
  2953. // Implementation
  2954. public:
  2955.     virtual ~CComboBox();
  2956. protected:
  2957.     virtual BOOL OnChildNotify(UINT, WPARAM, LPARAM, LRESULT*);
  2958. };
  2959.  
  2960. class CEdit : public CWnd
  2961. {
  2962.     DECLARE_DYNAMIC(CEdit)
  2963.  
  2964. // Constructors
  2965. public:
  2966.     CEdit();
  2967.     BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
  2968.  
  2969. // Attributes
  2970.     BOOL CanUndo() const;
  2971.     int GetLineCount() const;
  2972.     BOOL GetModify() const;
  2973.     void SetModify(BOOL bModified = TRUE);
  2974.     void GetRect(LPRECT lpRect) const;
  2975.     DWORD GetSel() const;
  2976.     void GetSel(int& nStartChar, int& nEndChar) const;
  2977. WCE_DEL    HLOCAL GetHandle() const;
  2978. WCE_DEL    void SetHandle(HLOCAL hBuffer);
  2979. #if (WINVER >= 0x400)
  2980.     void SetMargins(UINT nLeft, UINT nRight);
  2981.     DWORD GetMargins() const;
  2982.     void SetLimitText(UINT nMax);
  2983.     UINT GetLimitText() const;
  2984.     CPoint PosFromChar(UINT nChar) const;
  2985.     int CharFromPos(CPoint pt) const;
  2986. #endif
  2987.  
  2988.     // NOTE: first word in lpszBuffer must contain the size of the buffer!
  2989.     int GetLine(int nIndex, LPTSTR lpszBuffer) const;
  2990.     int GetLine(int nIndex, LPTSTR lpszBuffer, int nMaxLength) const;
  2991.  
  2992. // Operations
  2993.     void EmptyUndoBuffer();
  2994.     BOOL FmtLines(BOOL bAddEOL);
  2995.  
  2996.     void LimitText(int nChars = 0);
  2997.     int LineFromChar(int nIndex = -1) const;
  2998.     int LineIndex(int nLine = -1) const;
  2999.     int LineLength(int nLine = -1) const;
  3000.     void LineScroll(int nLines, int nChars = 0);
  3001.     void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE);
  3002.     void SetPasswordChar(TCHAR ch);
  3003.     void SetRect(LPCRECT lpRect);
  3004.     void SetRectNP(LPCRECT lpRect);
  3005.     void SetSel(DWORD dwSelection, BOOL bNoScroll = FALSE);
  3006.     void SetSel(int nStartChar, int nEndChar, BOOL bNoScroll = FALSE);
  3007.     BOOL SetTabStops(int nTabStops, LPINT rgTabStops);
  3008.     void SetTabStops();
  3009.     BOOL SetTabStops(const int& cxEachStop);    // takes an 'int'
  3010.  
  3011.     // Clipboard operations
  3012.     BOOL Undo();
  3013.     void Clear();
  3014.     void Copy();
  3015.     void Cut();
  3016.     void Paste();
  3017.  
  3018.     BOOL SetReadOnly(BOOL bReadOnly = TRUE);
  3019.     int GetFirstVisibleLine() const;
  3020.     TCHAR GetPasswordChar() const;
  3021.  
  3022. // Implementation
  3023. public:
  3024.     virtual ~CEdit();
  3025. };
  3026.  
  3027. class CScrollBar : public CWnd
  3028. {
  3029.     DECLARE_DYNAMIC(CScrollBar)
  3030.  
  3031. // Constructors
  3032. public:
  3033.     CScrollBar();
  3034.     BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
  3035.  
  3036. // Attributes
  3037.     int GetScrollPos() const;
  3038.     int SetScrollPos(int nPos, BOOL bRedraw = TRUE);
  3039.     void GetScrollRange(LPINT lpMinPos, LPINT lpMaxPos) const;
  3040.     void SetScrollRange(int nMinPos, int nMaxPos, BOOL bRedraw = TRUE);
  3041.     void ShowScrollBar(BOOL bShow = TRUE);
  3042.  
  3043. WCE_DEL    BOOL EnableScrollBar(UINT nArrowFlags = ESB_ENABLE_BOTH);
  3044.  
  3045.     BOOL SetScrollInfo(LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE);
  3046.     BOOL GetScrollInfo(LPSCROLLINFO lpScrollInfo, UINT nMask = SIF_ALL);
  3047.     int GetScrollLimit();
  3048.  
  3049. // Implementation
  3050. public:
  3051.     virtual ~CScrollBar();
  3052. };
  3053.  
  3054. /////////////////////////////////////////////////////////////////////////////
  3055. // CFrameWnd - base class for SDI and other frame windows
  3056.  
  3057. // Frame window styles
  3058. #define FWS_ADDTOTITLE  0x00008000L // modify title based on content
  3059. #define FWS_PREFIXTITLE 0x00004000L // show document name before app name
  3060. #define FWS_SNAPTOBARS  0x00002000L // snap size to size of contained bars
  3061.  
  3062. struct CPrintPreviewState;  // forward reference (see afxext.h)
  3063. class CControlBar;          // forward reference (see afxext.h)
  3064. class CReBar;                // forward reference (see afxext.h)
  3065.  
  3066. class CDockBar;             // forward reference (see afxpriv.h)
  3067. class CMiniDockFrameWnd;    // forward reference (see afxpriv.h)
  3068. class CDockState;           // forward reference (see afxpriv.h)
  3069.  
  3070. class COleFrameHook;        // forward reference (see ..\src\oleimpl2.h)
  3071.  
  3072. class CFrameWnd : public CWnd
  3073. {
  3074.     DECLARE_DYNCREATE(CFrameWnd)
  3075.  
  3076. // Constructors
  3077. public:
  3078.     static AFX_DATA const CRect rectDefault;
  3079.     CFrameWnd();
  3080.  
  3081.     BOOL LoadAccelTable(LPCTSTR lpszResourceName);
  3082.     BOOL Create(LPCTSTR lpszClassName,
  3083.                 LPCTSTR lpszWindowName,
  3084.                 DWORD dwStyle = WS_OVERLAPPEDWINDOW,
  3085.                 const RECT& rect = rectDefault,
  3086.                 CWnd* pParentWnd = NULL,        // != NULL for popups
  3087.                 LPCTSTR lpszMenuName = NULL,
  3088.                 DWORD dwExStyle = 0,
  3089.                 CCreateContext* pContext = NULL);
  3090.  
  3091.     // dynamic creation - load frame and associated resources
  3092.     virtual BOOL LoadFrame(UINT nIDResource,
  3093.                 DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE,
  3094.                 CWnd* pParentWnd = NULL,
  3095.                 CCreateContext* pContext = NULL);
  3096. #if defined(_WIN32_WCE)
  3097.     BOOL  InitCommandBar(UINT uiResourceID) 
  3098.         { return InitCommandBar(MAKEINTRESOURCE(uiResourceID)); }
  3099.     BOOL  InitCommandBar(LPCTSTR lpszMenuName);
  3100.     HWND  InsertComboBox(int iWidth);
  3101.     BOOL  InsertButtons(TBBUTTON arTBButtons[], UINT uiNButtons, int iToolbarBitmapID = -1, int iNImages = 0);
  3102.     BOOL  AddBitmap(int iToolbarBitmapID, int iNImages);
  3103.     HMENU InsertMenu(UINT uiResourceID)
  3104.         { return InsertMenu(MAKEINTRESOURCE(uiResourceID)); }
  3105.     HMENU InsertMenu(LPCTSTR lpszMenuName);
  3106.     HWND  ResetCommandBar();
  3107.     BOOL  AddComboBoxString(UINT uiStringResourceID, long lItemData = 0);
  3108.     BOOL  AddComboBoxString(LPCTSTR szString, long lItemData = 0);
  3109.     int   GetComboCount();
  3110.     int   GetComboCurSel();
  3111.     int   SetComboCurSel(int nSelect);
  3112.     int   GetHeight();
  3113.     BOOL  AddAdornments(DWORD dwFlags); 
  3114.     CFrameWnd*   m_poCommandBar;
  3115.     HWND         m_hCommandBar;
  3116.     LPCTSTR      m_lpszMenuName;
  3117. #endif // _WIN32_WCE
  3118.  
  3119.     // special helper for view creation
  3120.     CWnd* CreateView(CCreateContext* pContext, UINT nID = AFX_IDW_PANE_FIRST);
  3121.  
  3122. // Attributes
  3123.     virtual CDocument* GetActiveDocument();
  3124.  
  3125.     // Active child view maintenance
  3126.     CView* GetActiveView() const;           // active view or NULL
  3127.     void SetActiveView(CView* pViewNew, BOOL bNotify = TRUE);
  3128.         // active view or NULL, bNotify == FALSE if focus should not be set
  3129.  
  3130.     // Active frame (for frames within frames -- MDI)
  3131.     virtual CFrameWnd* GetActiveFrame();
  3132.  
  3133. #if !defined(_WIN32_WCE_NO_CONTROLBARS)
  3134.     // For customizing the default messages on the status bar
  3135.     virtual void GetMessageString(UINT nID, CString& rMessage) const;
  3136. #endif // _WIN32_WCE_NO_CONTROLBARS
  3137.  
  3138.     BOOL m_bAutoMenuEnable;
  3139.         // TRUE => menu items without handlers will be disabled
  3140.  
  3141.     BOOL IsTracking() const;
  3142.  
  3143. // Operations
  3144.     virtual void RecalcLayout(BOOL bNotify = TRUE);
  3145.     virtual void ActivateFrame(int nCmdShow = -1);
  3146.     void InitialUpdateFrame(CDocument* pDoc, BOOL bMakeVisible);
  3147.     void SetTitle(LPCTSTR lpszTitle);
  3148.     CString GetTitle() const;
  3149.  
  3150. #if !defined(_WIN32_WCE_NO_CONTROLBARS)
  3151.     // to set text of standard status bar
  3152.     void SetMessageText(LPCTSTR lpszText);
  3153.     void SetMessageText(UINT nID);
  3154.  
  3155.     // control bar docking
  3156. #if defined(_WIN32_WCE_NO_DOCKBARS)
  3157. // WinCE: Null implementations for forward compatibility
  3158.     void DockControlBar(CControlBar* pBar, UINT nDockBarID = 0,
  3159.         LPCRECT lpRect = NULL) {} 
  3160.     void EnableDocking(DWORD dwDockStyle) {}
  3161. #else // _WIN32_WCE_NO_DOCKBARS
  3162.     void EnableDocking(DWORD dwDockStyle);
  3163.     void DockControlBar(CControlBar* pBar, UINT nDockBarID = 0,
  3164.         LPCRECT lpRect = NULL);
  3165.     void FloatControlBar(CControlBar* pBar, CPoint point,
  3166.         DWORD dwStyle = CBRS_ALIGN_TOP);
  3167. #endif // _WIN32_WCE_NO_DOCKBARS
  3168.     CControlBar* GetControlBar(UINT nID);
  3169. #endif // _WIN32_WCE_NO_CONTROLBARS
  3170.  
  3171.     // frame window based modality
  3172.     virtual void BeginModalState();
  3173.     virtual void EndModalState();
  3174.     BOOL InModalState() const;
  3175.     void ShowOwnedWindows(BOOL bShow);
  3176.  
  3177. #if !defined(_WIN32_WCE_NO_CONTROLBARS)
  3178.     // saving and loading control bar state
  3179. #if !defined(_WIN32_WCE_NO_DOCKBARS)
  3180.     void LoadBarState(LPCTSTR lpszProfileName);
  3181.     void SaveBarState(LPCTSTR lpszProfileName) const;
  3182. #endif // _WIN32_WCE_NO_DOCKBARS
  3183.     void ShowControlBar(CControlBar* pBar, BOOL bShow, BOOL bDelay);
  3184. #if !defined(_WIN32_WCE_NO_DOCKBARS)
  3185.     void SetDockState(const CDockState& state);
  3186.     void GetDockState(CDockState& state) const;
  3187. #endif // _WIN32_WCE_NO_DOCKBARS
  3188.  
  3189. // Overridables
  3190. WCE_DEL virtual void OnSetPreviewMode(BOOL bPreview, CPrintPreviewState* pState);
  3191.     virtual CWnd* GetMessageBar();
  3192. #endif // _WIN32_WCE_NO_CONTROLBARS
  3193.  
  3194. #if !defined(_WIN32_WCE_NO_OLE)
  3195.     // border space negotiation
  3196.     enum BorderCmd
  3197.         { borderGet = 1, borderRequest = 2, borderSet = 3 };
  3198.     virtual BOOL NegotiateBorderSpace(UINT nBorderCmd, LPRECT lpRectBorder);
  3199. #endif // _WIN32_WCE_NO_OLE
  3200.  
  3201. protected:
  3202.     virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
  3203.  
  3204. // Command Handlers
  3205. public:
  3206. WCE_DEL    afx_msg void OnContextHelp();   // for Shift+F1 help
  3207. #if !defined(_WIN32_WCE_NO_CONTROLBARS)
  3208.     afx_msg void OnUpdateControlBarMenu(CCmdUI* pCmdUI);
  3209.     afx_msg BOOL OnBarCheck(UINT nID);
  3210. #endif // _WIN32_WCE_NO_CONTROLBARS
  3211.  
  3212. // Implementation
  3213. public:
  3214.     virtual ~CFrameWnd();
  3215.     int m_nWindow;  // general purpose window number - display as ":n"
  3216.                     // -1 => unknown, 0 => only window viewing document
  3217.                     // 1 => first of many windows viewing document, 2=> second
  3218.  
  3219.     HMENU m_hMenuDefault;       // default menu resource for this frame
  3220.     HACCEL m_hAccelTable;       // accelerator table
  3221.     DWORD m_dwPromptContext;    // current help prompt context for message box
  3222.     BOOL m_bHelpMode;           // if TRUE, then Shift+F1 help mode is active
  3223.     CFrameWnd* m_pNextFrameWnd; // next CFrameWnd in app global list
  3224.     CRect m_rectBorder;         // for OLE border space negotiation
  3225. WCE_DEL COleFrameHook* m_pNotifyHook;
  3226.  
  3227. #if !defined(_WIN32_WCE_NO_CONTROLBARS)
  3228.     CPtrList m_listControlBars; // array of all control bars that have this
  3229.                                 // window as their dock site
  3230. #endif // _WIN32_WCE_NO_CONTROLBARS
  3231.     int m_nShowDelay;           // SW_ command for delay show/hide
  3232.  
  3233. #if !defined(_WIN32_WCE_NO_CONTROLBARS)
  3234. #if !defined(_WIN32_WCE_NO_DOCKBARS)
  3235.     CMiniDockFrameWnd* CreateFloatingFrame(DWORD dwStyle);
  3236.     DWORD CanDock(CRect rect, DWORD dwDockStyle,
  3237.          CDockBar** ppDockBar = NULL); // called by CDockContext
  3238. #endif // _WIN32_WCE_NO_DOCKBARS
  3239.     void AddControlBar(CControlBar *pBar);
  3240.     void RemoveControlBar(CControlBar *pBar);
  3241. #if defined(_WIN32_WCE_NO_DOCKBARS)
  3242. // WinCE: Null implementation for forward compatibility
  3243.     void DockControlBar(CControlBar* pBar, void* pDockBar,
  3244.         LPCRECT lpRect = NULL) {}
  3245. #else // _WIN32_WCE_NO_DOCKBARS
  3246.     void DockControlBar(CControlBar* pBar, CDockBar* pDockBar,
  3247.          LPCRECT lpRect = NULL);
  3248.     void ReDockControlBar(CControlBar* pBar, CDockBar* pDockBar,
  3249.         LPCRECT lpRect = NULL);
  3250.     void NotifyFloatingWindows(DWORD dwFlags);
  3251. #endif // _WIN32_WCE_NO_DOCKBARS
  3252.     void DestroyDockBars(); 
  3253. #endif // _WIN32_WCE_NO_CONTROLBARS
  3254.  
  3255. protected:
  3256.     UINT m_nIDHelp;             // Help ID (0 for none, see HID_BASE_RESOURCE)
  3257.     UINT m_nIDTracking;         // tracking command ID or string IDS
  3258.     UINT m_nIDLastMessage;      // last displayed message string IDS
  3259.     CView* m_pViewActive;       // current active view
  3260.     BOOL (CALLBACK* m_lpfnCloseProc)(CFrameWnd* pFrameWnd);
  3261.     UINT m_cModalStack;         // BeginModalState depth
  3262.     HWND* m_phWndDisable;       // windows disabled because of BeginModalState
  3263.     HMENU m_hMenuAlt;           // menu to update to (NULL means default)
  3264.     CString m_strTitle;         // default title (original)
  3265.     BOOL m_bInRecalcLayout;     // avoid recursion in RecalcLayout
  3266. #if !defined(_WIN32_WCE_NO_DOCKBARS)
  3267.     CRuntimeClass* m_pFloatingFrameClass;
  3268.     static const DWORD dwDockBarMap[4][2];
  3269. #endif // _WIN32_WCE_NO_DOCKBARS
  3270.  
  3271. public:
  3272. #ifdef _DEBUG
  3273.     virtual void AssertValid() const;
  3274.     virtual void Dump(CDumpContext& dc) const;
  3275. #endif
  3276.     virtual BOOL IsFrameWnd() const;
  3277.     virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,
  3278.         AFX_CMDHANDLERINFO* pHandlerInfo);
  3279.     virtual void OnUpdateFrameTitle(BOOL bAddToTitle);
  3280.     virtual void OnUpdateFrameMenu(HMENU hMenuAlt);
  3281.     virtual HACCEL GetDefaultAccelerator();
  3282.     virtual BOOL PreTranslateMessage(MSG* pMsg);
  3283.  
  3284.     // idle update of frame user interface
  3285.     enum IdleFlags
  3286.         { idleMenu = 1, idleTitle = 2, idleNotify = 4, idleLayout = 8 };
  3287.     UINT m_nIdleFlags;          // set of bit flags for idle processing
  3288.     virtual void DelayUpdateFrameMenu(HMENU hMenuAlt);
  3289.     void DelayUpdateFrameTitle();
  3290.     void DelayRecalcLayout(BOOL bNotify = TRUE);
  3291.  
  3292.     // for Shift+F1 help support
  3293. WCE_DEL    BOOL CanEnterHelpMode();
  3294. WCE_DEL    virtual void ExitHelpMode();
  3295.  
  3296.     // implementation helpers
  3297. public:
  3298.     void UpdateFrameTitleForDocument(LPCTSTR lpszDocName);
  3299. protected:
  3300.     LPCTSTR GetIconWndClass(DWORD dwDefaultStyle, UINT nIDResource);
  3301.     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  3302.     virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
  3303.     virtual void PostNcDestroy();   // default to delete this.
  3304.     int OnCreateHelper(LPCREATESTRUCT lpcs, CCreateContext* pContext);
  3305.     void BringToTop(int nCmdShow);
  3306.         // bring window to top for SW_ commands which affect z-order
  3307.  
  3308.     // implementation helpers for Shift+F1 help mode
  3309. WCE_DEL    BOOL ProcessHelpMsg(MSG& msg, DWORD* pContext);
  3310. WCE_DEL    HWND SetHelpCapture(POINT point, BOOL* pbDescendant);
  3311.  
  3312.     // CFrameWnd list management
  3313.     void AddFrameWnd();
  3314.     void RemoveFrameWnd();
  3315.  
  3316.     friend class CWnd;  // for access to m_bModalDisable
  3317. #if !defined(_WIN32_WCE_NO_CONTROLBARS)
  3318.     friend class CReBar; // for access to m_bInRecalcLayout
  3319. #endif // _WIN32_WCE_NO_CONTROLBARS
  3320.  
  3321.     //{{AFX_MSG(CFrameWnd)
  3322.     // Windows messages
  3323.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  3324.     afx_msg void OnDestroy();
  3325.     afx_msg void OnClose();
  3326. WCE_DEL afx_msg void OnInitMenu(CMenu*);
  3327.     afx_msg void OnInitMenuPopup(CMenu*, UINT, BOOL);
  3328. WCE_DEL    afx_msg void OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu);
  3329. #if !defined(_WIN32_WCE_NO_CONTROLBARS)
  3330.     afx_msg LRESULT OnPopMessageString(WPARAM wParam, LPARAM lParam);
  3331.     afx_msg LRESULT OnSetMessageString(WPARAM wParam, LPARAM lParam);
  3332.     afx_msg LRESULT OnHelpPromptAddr(WPARAM wParam, LPARAM lParam);
  3333. #endif // _WIN32_WCE_NO_CONTROLBARS
  3334.     afx_msg void OnIdleUpdateCmdUI();
  3335. WCE_DEL afx_msg void OnEnterIdle(UINT nWhy, CWnd* pWho);
  3336.     afx_msg void OnSetFocus(CWnd* pOldWnd);
  3337.     afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  3338.     afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  3339.     afx_msg void OnSize(UINT nType, int cx, int cy);
  3340.     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  3341.     afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
  3342. WCE_DEL    afx_msg BOOL OnNcActivate(BOOL bActive);
  3343.     afx_msg void OnSysCommand(UINT nID, LONG lParam);
  3344. WCE_DEL    afx_msg BOOL OnQueryEndSession();
  3345. WCE_DEL    afx_msg void OnEndSession(BOOL bEnding);
  3346. WCE_DEL    afx_msg void OnDropFiles(HDROP hDropInfo);
  3347. #if !defined(_WIN32_WCE_NO_CURSOR)
  3348.     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  3349. #endif // _WIN32_WCE_NO_CURSOR
  3350.     afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
  3351.     afx_msg LRESULT OnHelpHitTest(WPARAM wParam, LPARAM lParam);
  3352.     afx_msg LRESULT OnActivateTopLevel(WPARAM wParam, LPARAM lParam);
  3353.     afx_msg void OnEnable(BOOL bEnable);
  3354.     afx_msg void OnPaletteChanged(CWnd* pFocusWnd);
  3355.     afx_msg BOOL OnQueryNewPalette();
  3356.     // standard commands
  3357. #if !defined(_WIN32_WCE_NO_CONTROLBARS)
  3358. #if !defined(_WIN32_WCE_NO_TOOLTIPS)
  3359.     afx_msg BOOL OnToolTipText(UINT nID, NMHDR* pNMHDR, LRESULT* pResult);
  3360. #endif // _WIN32_WCE_NO_TOOLTIPS
  3361.     afx_msg void OnUpdateKeyIndicator(CCmdUI* pCmdUI);
  3362. #endif // _WIN32_WCE_NO_CONTROLBARS
  3363.     afx_msg void OnHelp();
  3364. WCE_DEL afx_msg void OnUpdateContextHelp(CCmdUI* pCmdUI);
  3365.     //}}AFX_MSG
  3366. protected:
  3367. WCE_DEL    afx_msg LRESULT OnDDEInitiate(WPARAM wParam, LPARAM lParam);
  3368. WCE_DEL    afx_msg LRESULT OnDDEExecute(WPARAM wParam, LPARAM lParam);
  3369. WCE_DEL    afx_msg LRESULT OnDDETerminate(WPARAM wParam, LPARAM lParam);
  3370. WCE_DEL    afx_msg LRESULT OnRegisteredMouseWheel(WPARAM wParam, LPARAM lParam);
  3371.     DECLARE_MESSAGE_MAP()
  3372.  
  3373.     friend class CWinApp;
  3374. };
  3375.  
  3376. #if !defined(_WIN32_WCE)
  3377. /////////////////////////////////////////////////////////////////////////////
  3378. // MDI Support
  3379.  
  3380. class CMDIFrameWnd : public CFrameWnd
  3381. {
  3382.     DECLARE_DYNCREATE(CMDIFrameWnd)
  3383.  
  3384. public:
  3385. // Constructors
  3386.     CMDIFrameWnd();
  3387.  
  3388. // Operations
  3389.     void MDIActivate(CWnd* pWndActivate);
  3390.     CMDIChildWnd* MDIGetActive(BOOL* pbMaximized = NULL) const;
  3391.     void MDIIconArrange();
  3392.     void MDIMaximize(CWnd* pWnd);
  3393.     void MDINext();
  3394.     void MDIRestore(CWnd* pWnd);
  3395.     CMenu* MDISetMenu(CMenu* pFrameMenu, CMenu* pWindowMenu);
  3396.     void MDITile();
  3397.     void MDICascade();
  3398.     void MDITile(int nType);
  3399.     void MDICascade(int nType);
  3400.     CMDIChildWnd* CreateNewChild(CRuntimeClass* pClass,    UINT nResource,
  3401.         HMENU hMenu = NULL, HACCEL hAccel = NULL);
  3402.  
  3403. // Overridables
  3404.     // MFC 1.0 backward compatible CreateClient hook (called by OnCreateClient)
  3405.     virtual BOOL CreateClient(LPCREATESTRUCT lpCreateStruct, CMenu* pWindowMenu);
  3406.     // customize if using an 'Window' menu with non-standard IDs
  3407.     virtual HMENU GetWindowMenuPopup(HMENU hMenuBar);
  3408.  
  3409. // Implementation
  3410. public:
  3411.     HWND m_hWndMDIClient;       // MDI Client window handle
  3412.  
  3413. #ifdef _DEBUG
  3414.     virtual void AssertValid() const;
  3415.     virtual void Dump(CDumpContext& dc) const;
  3416. #endif
  3417.     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  3418.     virtual BOOL LoadFrame(UINT nIDResource,
  3419.                 DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE,
  3420.                 CWnd* pParentWnd = NULL,
  3421.                 CCreateContext* pContext = NULL);
  3422.     virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
  3423.     virtual BOOL PreTranslateMessage(MSG* pMsg);
  3424.     virtual void OnUpdateFrameTitle(BOOL bAddToTitle);
  3425.     virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,
  3426.         AFX_CMDHANDLERINFO* pHandlerInfo);
  3427.     virtual void OnUpdateFrameMenu(HMENU hMenuAlt);
  3428.     virtual void DelayUpdateFrameMenu(HMENU hMenuAlt);
  3429.     virtual CFrameWnd* GetActiveFrame();
  3430.  
  3431. protected:
  3432.     virtual LRESULT DefWindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam);
  3433.     virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
  3434.  
  3435.     //{{AFX_MSG(CMDIFrameWnd)
  3436.     afx_msg void OnDestroy();
  3437.     afx_msg void OnSize(UINT nType, int cx, int cy);
  3438.     afx_msg void OnUpdateMDIWindowCmd(CCmdUI* pCmdUI);
  3439.     afx_msg BOOL OnMDIWindowCmd(UINT nID);
  3440.     afx_msg void OnWindowNew();
  3441.     afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
  3442.     afx_msg void OnIdleUpdateCmdUI();
  3443.     afx_msg LRESULT OnMenuChar(UINT nChar, UINT, CMenu*);
  3444.     //}}AFX_MSG
  3445.     DECLARE_MESSAGE_MAP()
  3446. };
  3447.  
  3448. class CMDIChildWnd : public CFrameWnd
  3449. {
  3450.     DECLARE_DYNCREATE(CMDIChildWnd)
  3451.  
  3452. // Constructors
  3453. public:
  3454.     CMDIChildWnd();
  3455.  
  3456.     virtual BOOL Create(LPCTSTR lpszClassName,
  3457.                 LPCTSTR lpszWindowName,
  3458.                 DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_OVERLAPPEDWINDOW,
  3459.                 const RECT& rect = rectDefault,
  3460.                 CMDIFrameWnd* pParentWnd = NULL,
  3461.                 CCreateContext* pContext = NULL);
  3462.  
  3463. // Attributes
  3464.     CMDIFrameWnd* GetMDIFrame();
  3465.  
  3466. // Operations
  3467.     void MDIDestroy();
  3468.     void MDIActivate();
  3469.     void MDIMaximize();
  3470.     void MDIRestore();
  3471.     void SetHandles(HMENU hMenu, HACCEL hAccel);
  3472.  
  3473. // Implementation
  3474. protected:
  3475.     HMENU m_hMenuShared;        // menu when we are active
  3476.  
  3477. public:
  3478. #ifdef _DEBUG
  3479.     virtual void AssertValid() const;
  3480.     virtual void Dump(CDumpContext& dc) const;
  3481. #endif
  3482.  
  3483.     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  3484.     virtual BOOL LoadFrame(UINT nIDResource, DWORD dwDefaultStyle,
  3485.                     CWnd* pParentWnd, CCreateContext* pContext = NULL);
  3486.         // 'pParentWnd' parameter is required for MDI Child
  3487.     virtual BOOL DestroyWindow();
  3488.     virtual BOOL PreTranslateMessage(MSG* pMsg);
  3489.     virtual void ActivateFrame(int nCmdShow = -1);
  3490.     virtual void OnUpdateFrameMenu(BOOL bActive, CWnd* pActivateWnd,
  3491.         HMENU hMenuAlt);
  3492.  
  3493.     BOOL m_bPseudoInactive;     // TRUE if window is MDI active according to
  3494.                                 //  windows, but not according to MFC...
  3495.  
  3496. protected:
  3497.     virtual CWnd* GetMessageBar();
  3498.     virtual void OnUpdateFrameTitle(BOOL bAddToTitle);
  3499.     virtual LRESULT DefWindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam);
  3500.     BOOL UpdateClientEdge(LPRECT lpRect = NULL);
  3501.  
  3502.     //{{AFX_MSG(CMDIChildWnd)
  3503.     afx_msg void OnMDIActivate(BOOL bActivate, CWnd*, CWnd*);
  3504.     afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
  3505.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  3506.     afx_msg BOOL OnNcCreate(LPCREATESTRUCT lpCreateStruct);
  3507.     afx_msg void OnSize(UINT nType, int cx, int cy);
  3508.     afx_msg void OnWindowPosChanging(LPWINDOWPOS lpWndPos);
  3509.     afx_msg BOOL OnNcActivate(BOOL bActive);
  3510.     afx_msg void OnDestroy();
  3511.     afx_msg BOOL OnToolTipText(UINT nID, NMHDR* pNMHDR, LRESULT* pResult);
  3512.     //}}AFX_MSG
  3513.     DECLARE_MESSAGE_MAP()
  3514. };
  3515.  
  3516. /////////////////////////////////////////////////////////////////////////////
  3517. // CMiniFrameWnd
  3518.  
  3519. // MiniFrame window styles
  3520. #define MFS_SYNCACTIVE      0x00000100L // syncronize activation w/ parent
  3521. #define MFS_4THICKFRAME     0x00000200L // thick frame all around (no tiles)
  3522. #define MFS_THICKFRAME      0x00000400L // use instead of WS_THICKFRAME
  3523. #define MFS_MOVEFRAME       0x00000800L // no sizing, just moving
  3524. #define MFS_BLOCKSYSMENU    0x00001000L // block hit testing on system menu
  3525.  
  3526. class CMiniFrameWnd : public CFrameWnd
  3527. {
  3528.     DECLARE_DYNCREATE(CMiniFrameWnd)
  3529.  
  3530. // Constructors
  3531. public:
  3532.     CMiniFrameWnd();
  3533.     BOOL Create(LPCTSTR lpClassName, LPCTSTR lpWindowName,
  3534.         DWORD dwStyle, const RECT& rect,
  3535.         CWnd* pParentWnd = NULL, UINT nID = 0);
  3536.     BOOL CreateEx(DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName,
  3537.         DWORD dwStyle, const RECT& rect,
  3538.         CWnd* pParentWnd = NULL, UINT nID = 0);
  3539.  
  3540. // Implementation
  3541. public:
  3542.     ~CMiniFrameWnd();
  3543.  
  3544.     static void AFX_CDECL Initialize();
  3545.  
  3546.     //{{AFX_MSG(CMiniFrameWnd)
  3547.     afx_msg BOOL OnNcActivate(BOOL bActive);
  3548.     afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpParams);
  3549.     afx_msg UINT OnNcHitTest(CPoint point);
  3550.     afx_msg void OnNcPaint();
  3551.     afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint pt);
  3552.     afx_msg void OnLButtonUp(UINT nFlags, CPoint pt);
  3553.     afx_msg void OnMouseMove(UINT nFlags, CPoint pt);
  3554.     afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
  3555.     afx_msg void OnGetMinMaxInfo(MINMAXINFO* pMMI);
  3556.     afx_msg LRESULT OnGetText(WPARAM wParam, LPARAM lParam);
  3557.     afx_msg LRESULT OnGetTextLength(WPARAM wParam, LPARAM lParam);
  3558.     afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
  3559.     afx_msg LRESULT OnFloatStatus(WPARAM wParam, LPARAM lParam);
  3560.     afx_msg LRESULT OnQueryCenterWnd(WPARAM wParam, LPARAM lParam);
  3561.     afx_msg BOOL OnNcCreate(LPCREATESTRUCT lpcs);
  3562.     //}}AFX_MSG
  3563.     DECLARE_MESSAGE_MAP()
  3564.  
  3565. public:
  3566.     virtual void CalcWindowRect(LPRECT lpClientRect,
  3567.         UINT nAdjustType = adjustBorder);
  3568.  
  3569.     static void PASCAL CalcBorders(LPRECT lpClientRect,
  3570.         DWORD dwStyle = WS_THICKFRAME | WS_CAPTION, DWORD dwExStyle = 0);
  3571.  
  3572. protected:
  3573.     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  3574.  
  3575. protected:
  3576.     BOOL m_bSysTracking;
  3577.     BOOL m_bInSys;
  3578.     BOOL m_bActive;
  3579.     CString m_strCaption;
  3580.  
  3581.     void InvertSysMenu();
  3582. };
  3583. #endif // _WIN32_WCE
  3584.  
  3585. /////////////////////////////////////////////////////////////////////////////
  3586. // class CView is the client area UI for a document
  3587.  
  3588. class CPrintDialog;     // forward reference (see afxdlgs.h)
  3589. class CPreviewView;     // forward reference (see afxpriv.h)
  3590. class CSplitterWnd;     // forward reference (see afxext.h)
  3591. class COleServerDoc;    // forward reference (see afxole.h)
  3592.  
  3593. typedef DWORD DROPEFFECT;
  3594. class COleDataObject;   // forward reference (see afxole.h)
  3595.  
  3596. #ifdef _AFXDLL
  3597. class CView : public CWnd
  3598. #else
  3599. class AFX_NOVTABLE CView : public CWnd
  3600. #endif
  3601. {
  3602.     DECLARE_DYNAMIC(CView)
  3603.  
  3604. // Constructors
  3605. protected:
  3606.     CView();
  3607.  
  3608. // Attributes
  3609. public:
  3610.     CDocument* GetDocument() const;
  3611.  
  3612. // Operations
  3613. public:
  3614. #if !defined(_WIN32_WCE_NO_PRINTING)
  3615.     // for standard printing setup (override OnPreparePrinting)
  3616.     BOOL DoPreparePrinting(CPrintInfo* pInfo);
  3617. #endif // _WIN32_WCE_NO_PRINTING
  3618.  
  3619. // Overridables
  3620. public:
  3621. #if !defined(_WIN32_WCE_NO_OLE)
  3622.     virtual BOOL IsSelected(const CObject* pDocItem) const; // support for OLE
  3623. #endif // _WIN32_WCE_NO_OLE
  3624.  
  3625.     // OLE scrolling support (used for drag/drop as well)
  3626.     virtual BOOL OnScroll(UINT nScrollCode, UINT nPos, BOOL bDoScroll = TRUE);
  3627.     virtual BOOL OnScrollBy(CSize sizeScroll, BOOL bDoScroll = TRUE);
  3628.  
  3629. #if !defined(_WIN32_WCE)
  3630.     // OLE drag/drop support
  3631.     virtual DROPEFFECT OnDragEnter(COleDataObject* pDataObject,
  3632.         DWORD dwKeyState, CPoint point);
  3633.     virtual DROPEFFECT OnDragOver(COleDataObject* pDataObject,
  3634.         DWORD dwKeyState, CPoint point);
  3635.     virtual void OnDragLeave();
  3636.     virtual BOOL OnDrop(COleDataObject* pDataObject,
  3637.         DROPEFFECT dropEffect, CPoint point);
  3638.     virtual DROPEFFECT OnDropEx(COleDataObject* pDataObject,
  3639.         DROPEFFECT dropDefault, DROPEFFECT dropList, CPoint point);
  3640.     virtual DROPEFFECT OnDragScroll(DWORD dwKeyState, CPoint point);
  3641. #endif // _WIN32_WCE_NO_OLE
  3642.  
  3643. #if defined(_WIN32_WCE_NO_PRINTING)
  3644.     virtual void OnPrepareDC(CDC* pDC, const void* pUnused = NULL);
  3645. #else // _WIN32_WCE_NO_PRINTING
  3646.     virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
  3647. #endif // _WIN32_WCE_NO_PRINTING
  3648.  
  3649.     virtual void OnInitialUpdate(); // called first time after construct
  3650.  
  3651. protected:
  3652.     // Activation
  3653.     virtual void OnActivateView(BOOL bActivate, CView* pActivateView,
  3654.                     CView* pDeactiveView);
  3655.     virtual void OnActivateFrame(UINT nState, CFrameWnd* pFrameWnd);
  3656.  
  3657.     // General drawing/updating
  3658.     virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
  3659.     virtual void OnDraw(CDC* pDC) = 0;
  3660.  
  3661. #if !defined(_WIN32_WCE_NO_PRINTING)
  3662.     // Printing support
  3663.     virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
  3664.         // must override to enable printing and print preview
  3665.  
  3666.     virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
  3667.     virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
  3668.     virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
  3669.  
  3670.     // Advanced: end print preview mode, move to point
  3671. WCE_DEL virtual void OnEndPrintPreview(CDC* pDC, CPrintInfo* pInfo, POINT point,
  3672. WCE_DEL        CPreviewView* pView);
  3673. #endif // _WIN32_WCE_NO_PRINTING
  3674.  
  3675. // Implementation
  3676. public:
  3677.     virtual ~CView();
  3678. #ifdef _DEBUG
  3679.     virtual void Dump(CDumpContext&) const;
  3680.     virtual void AssertValid() const;
  3681. #endif //_DEBUG
  3682.  
  3683.     // Advanced: for implementing custom print preview
  3684. WCE_DEL BOOL DoPrintPreview(UINT nIDResource, CView* pPrintView,
  3685. WCE_DEL             CRuntimeClass* pPreviewViewClass, CPrintPreviewState* pState);
  3686.  
  3687.     virtual void CalcWindowRect(LPRECT lpClientRect,
  3688.         UINT nAdjustType = adjustBorder);
  3689.     virtual CScrollBar* GetScrollBarCtrl(int nBar) const;
  3690.     static CSplitterWnd* PASCAL GetParentSplitter(
  3691.         const CWnd* pWnd, BOOL bAnyState);
  3692.  
  3693. protected:
  3694.     CDocument* m_pDocument;
  3695.  
  3696. public:
  3697.     virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,
  3698.         AFX_CMDHANDLERINFO* pHandlerInfo);
  3699. protected:
  3700.     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  3701.     virtual void PostNcDestroy();
  3702.  
  3703.     // friend classes that call protected CView overridables
  3704.     friend class CDocument;
  3705.     friend class CDocTemplate;
  3706.     friend class CPreviewView;
  3707.     friend class CFrameWnd;
  3708.     friend class CMDIFrameWnd;
  3709.     friend class CMDIChildWnd;
  3710.     friend class CSplitterWnd;
  3711.     friend class COleServerDoc;
  3712.     friend class CDocObjectServer;
  3713.  
  3714.     //{{AFX_MSG(CView)
  3715.     afx_msg int OnCreate(LPCREATESTRUCT lpcs);
  3716.     afx_msg void OnDestroy();
  3717.     afx_msg void OnPaint();
  3718. WCE_DEL    afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
  3719.     // commands
  3720.     afx_msg void OnUpdateSplitCmd(CCmdUI* pCmdUI);
  3721.     afx_msg BOOL OnSplitCmd(UINT nID);
  3722.     afx_msg void OnUpdateNextPaneMenu(CCmdUI* pCmdUI);
  3723.     afx_msg BOOL OnNextPaneCmd(UINT nID);
  3724.  
  3725.     // not mapped commands - must be mapped in derived class
  3726. #if !defined(_WIN32_WCE_NO_PRINTING)
  3727.     afx_msg void OnFilePrint();
  3728. #endif // _WIN32_WCE_NO_PRINTING
  3729. WCE_DEL    afx_msg void OnFilePrintPreview();
  3730.     //}}AFX_MSG
  3731.     DECLARE_MESSAGE_MAP()
  3732. };
  3733.  
  3734. /////////////////////////////////////////////////////////////////////////////
  3735. // class CCtrlView allows almost any control to be a view
  3736.  
  3737. #ifdef _AFXDLL
  3738. class CCtrlView : public CView
  3739. #else
  3740. class AFX_NOVTABLE CCtrlView : public CView
  3741. #endif
  3742. {
  3743.     DECLARE_DYNCREATE(CCtrlView)
  3744.  
  3745. public:
  3746.     CCtrlView(LPCTSTR lpszClass, DWORD dwStyle);
  3747.  
  3748. // Attributes
  3749. protected:
  3750.     CString m_strClass;
  3751.     DWORD m_dwDefaultStyle;
  3752.  
  3753. // Overrides
  3754.     virtual void OnDraw(CDC*);
  3755.     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  3756.  
  3757. // Implementation
  3758. public:
  3759. #ifdef _DEBUG
  3760.     virtual void Dump(CDumpContext&) const;
  3761.     virtual void AssertValid() const;
  3762. #endif //_DEBUG
  3763.  
  3764. protected:
  3765.     afx_msg void OnPaint();
  3766.     DECLARE_MESSAGE_MAP()
  3767. };
  3768.  
  3769. /////////////////////////////////////////////////////////////////////////////
  3770. // class CScrollView supports simple scrolling and scaling
  3771.  
  3772. class CScrollView : public CView
  3773. {
  3774.     DECLARE_DYNAMIC(CScrollView)
  3775.  
  3776. // Constructors
  3777. protected:
  3778.     CScrollView();
  3779.  
  3780. public:
  3781.     static AFX_DATA const SIZE sizeDefault;
  3782.         // used to specify default calculated page and line sizes
  3783.  
  3784.     // in logical units - call one of the following Set routines
  3785.     void SetScaleToFitSize(SIZE sizeTotal);
  3786.     void SetScrollSizes(int nMapMode, SIZE sizeTotal,
  3787.                 const SIZE& sizePage = sizeDefault,
  3788.                 const SIZE& sizeLine = sizeDefault);
  3789.  
  3790. // Attributes
  3791. public:
  3792.     CPoint GetScrollPosition() const;       // upper corner of scrolling
  3793.     CSize GetTotalSize() const;             // logical size
  3794.  
  3795.     // for device units
  3796.     CPoint GetDeviceScrollPosition() const;
  3797.     void GetDeviceScrollSizes(int& nMapMode, SIZE& sizeTotal,
  3798.             SIZE& sizePage, SIZE& sizeLine) const;
  3799.  
  3800. // Operations
  3801. public:
  3802.     void ScrollToPosition(POINT pt);    // set upper left position
  3803.     void FillOutsideRect(CDC* pDC, CBrush* pBrush);
  3804.     void ResizeParentToFit(BOOL bShrinkOnly = TRUE);
  3805. WCE_DEL    BOOL DoMouseWheel(UINT fFlags, short zDelta, CPoint point);
  3806.  
  3807. // Implementation
  3808. protected:
  3809.     int m_nMapMode;
  3810.     CSize m_totalLog;           // total size in logical units (no rounding)
  3811.     CSize m_totalDev;           // total size in device units
  3812.     CSize m_pageDev;            // per page scroll size in device units
  3813.     CSize m_lineDev;            // per line scroll size in device units
  3814.  
  3815.     BOOL m_bCenter;             // Center output if larger than total size
  3816.     BOOL m_bInsideUpdate;       // internal state for OnSize callback
  3817.     void CenterOnPoint(CPoint ptCenter);
  3818.     void ScrollToDevicePosition(POINT ptDev); // explicit scrolling no checking
  3819.  
  3820. protected:
  3821.     virtual void OnDraw(CDC* pDC) = 0;      // pass on pure virtual
  3822.  
  3823.     void UpdateBars();          // adjust scrollbars etc
  3824.     BOOL GetTrueClientSize(CSize& size, CSize& sizeSb);
  3825.         // size with no bars
  3826.     void GetScrollBarSizes(CSize& sizeSb);
  3827.     void GetScrollBarState(CSize sizeClient, CSize& needSb,
  3828.         CSize& sizeRange, CPoint& ptMove, BOOL bInsideClient);
  3829.  
  3830. public:
  3831.     virtual ~CScrollView();
  3832. #ifdef _DEBUG
  3833.     virtual void Dump(CDumpContext&) const;
  3834.     virtual void AssertValid() const;
  3835. #endif //_DEBUG
  3836.     virtual void CalcWindowRect(LPRECT lpClientRect,
  3837.         UINT nAdjustType = adjustBorder);
  3838. #if defined(_WIN32_WCE_NO_PRINTING)
  3839.     virtual void OnPrepareDC(CDC* pDC, const void* pUnused = NULL);
  3840. #else // _WIN32_WCE_NO_PRINTING
  3841.     virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
  3842. #endif // _WIN32_WCE_NO_PRINTING
  3843.  
  3844.     // scrolling implementation support for OLE
  3845.     virtual BOOL OnScroll(UINT nScrollCode, UINT nPos, BOOL bDoScroll = TRUE);
  3846.     virtual BOOL OnScrollBy(CSize sizeScroll, BOOL bDoScroll = TRUE);
  3847.  
  3848.     //{{AFX_MSG(CScrollView)
  3849.     afx_msg void OnSize(UINT nType, int cx, int cy);
  3850.     afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  3851.     afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  3852. WCE_DEL    afx_msg BOOL OnMouseWheel(UINT fFlags, short zDelta, CPoint point);
  3853.     //}}AFX_MSG
  3854.     DECLARE_MESSAGE_MAP()
  3855. };
  3856.  
  3857. /////////////////////////////////////////////////////////////////////////////
  3858. // CWinThread
  3859.  
  3860. typedef UINT (AFX_CDECL *AFX_THREADPROC)(LPVOID);
  3861.  
  3862. class COleMessageFilter;        // forward reference (see afxole.h)
  3863.  
  3864. class CWinThread : public CCmdTarget
  3865. {
  3866.     DECLARE_DYNAMIC(CWinThread)
  3867.  
  3868. public:
  3869. // Constructors
  3870.     CWinThread();
  3871.     BOOL CreateThread(DWORD dwCreateFlags = 0, UINT nStackSize = 0,
  3872.         LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL);
  3873.  
  3874. // Attributes
  3875.     CWnd* m_pMainWnd;       // main window (usually same AfxGetApp()->m_pMainWnd)
  3876.     CWnd* m_pActiveWnd;     // active main window (may not be m_pMainWnd)
  3877.     BOOL m_bAutoDelete;     // enables 'delete this' after thread termination
  3878.  
  3879.     // only valid while running
  3880.     HANDLE m_hThread;       // this thread's HANDLE
  3881.     operator HANDLE() const;
  3882.     DWORD m_nThreadID;      // this thread's ID
  3883.  
  3884.     int GetThreadPriority();
  3885.     BOOL SetThreadPriority(int nPriority);
  3886.  
  3887. // Operations
  3888.     DWORD SuspendThread();
  3889.     DWORD ResumeThread();
  3890.     BOOL PostThreadMessage(UINT message, WPARAM wParam, LPARAM lParam);
  3891.  
  3892. // Overridables
  3893.     // thread initialization
  3894.     virtual BOOL InitInstance();
  3895.  
  3896.     // running and idle processing
  3897.     virtual int Run();
  3898.     virtual BOOL PreTranslateMessage(MSG* pMsg);
  3899.     virtual BOOL PumpMessage();     // low level message pump
  3900.     virtual BOOL OnIdle(LONG lCount); // return TRUE if more idle processing
  3901.     virtual BOOL IsIdleMessage(MSG* pMsg);  // checks for special messages
  3902.  
  3903.     // thread termination
  3904.     virtual int ExitInstance(); // default will 'delete this'
  3905.  
  3906.     // Advanced: exception handling
  3907.     virtual LRESULT ProcessWndProcException(CException* e, const MSG* pMsg);
  3908.  
  3909.     // Advanced: handling messages sent to message filter hook
  3910. WCE_DEL    virtual BOOL ProcessMessageFilter(int code, LPMSG lpMsg);
  3911.  
  3912.     // Advanced: virtual access to m_pMainWnd
  3913.     virtual CWnd* GetMainWnd();
  3914.  
  3915. // Implementation
  3916. public:
  3917.     virtual ~CWinThread();
  3918. #ifdef _DEBUG
  3919.     virtual void AssertValid() const;
  3920.     virtual void Dump(CDumpContext& dc) const;
  3921.     int m_nDisablePumpCount; // Diagnostic trap to detect illegal re-entrancy
  3922. #endif
  3923.     void CommonConstruct();
  3924.     virtual void Delete();
  3925.         // 'delete this' only if m_bAutoDelete == TRUE
  3926.  
  3927.     // message pump for Run
  3928.     MSG m_msgCur;                   // current message
  3929.  
  3930. public:
  3931.     // constructor used by implementation of AfxBeginThread
  3932.     CWinThread(AFX_THREADPROC pfnThreadProc, LPVOID pParam);
  3933.  
  3934.     // valid after construction
  3935.     LPVOID m_pThreadParams; // generic parameters passed to starting function
  3936.     AFX_THREADPROC m_pfnThreadProc;
  3937.  
  3938.     // set after OLE is initialized
  3939. #if !defined(_WIN32_WCE_NO_OLE)
  3940.     void (AFXAPI* m_lpfnOleTermOrFreeLib)(BOOL, BOOL);
  3941. #endif // _WIN32_WCE_NO_OLE
  3942. WCE_DEL    COleMessageFilter* m_pMessageFilter;
  3943.  
  3944. protected:
  3945.     CPoint m_ptCursorLast;      // last mouse position
  3946.     UINT m_nMsgLast;            // last mouse message
  3947.     BOOL DispatchThreadMessageEx(MSG* msg);  // helper
  3948.     void DispatchThreadMessage(MSG* msg);  // obsolete
  3949. };
  3950.  
  3951. // global helpers for threads
  3952.  
  3953. CWinThread* AFXAPI AfxBeginThread(AFX_THREADPROC pfnThreadProc, LPVOID pParam,
  3954.     int nPriority = THREAD_PRIORITY_NORMAL, UINT nStackSize = 0,
  3955.     DWORD dwCreateFlags = 0, LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL);
  3956. CWinThread* AFXAPI AfxBeginThread(CRuntimeClass* pThreadClass,
  3957.     int nPriority = THREAD_PRIORITY_NORMAL, UINT nStackSize = 0,
  3958.     DWORD dwCreateFlags = 0, LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL);
  3959.  
  3960. CWinThread* AFXAPI AfxGetThread();
  3961. void AFXAPI AfxEndThread(UINT nExitCode, BOOL bDelete = TRUE);
  3962.  
  3963. void AFXAPI AfxInitThread();
  3964. void AFXAPI AfxTermThread(HINSTANCE hInstTerm = NULL);
  3965.  
  3966. /////////////////////////////////////////////////////////////////////////////
  3967. // Global functions for access to the one and only CWinApp
  3968.  
  3969. #define afxCurrentWinApp    AfxGetModuleState()->m_pCurrentWinApp
  3970. #define afxCurrentInstanceHandle    AfxGetModuleState()->m_hCurrentInstanceHandle
  3971. #define afxCurrentResourceHandle    AfxGetModuleState()->m_hCurrentResourceHandle
  3972. #define afxCurrentAppName   AfxGetModuleState()->m_lpszCurrentAppName
  3973. #define afxContextIsDLL     AfxGetModuleState()->m_bDLL
  3974. #define afxRegisteredClasses    AfxGetModuleState()->m_fRegisteredClasses
  3975.  
  3976. #ifndef _AFX_NO_OCC_SUPPORT
  3977. #define afxOccManager   AfxGetModuleState()->m_pOccManager
  3978. #endif
  3979.  
  3980. // Advanced initialization: for overriding default WinMain
  3981. BOOL AFXAPI AfxWinInit(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  3982.     LPTSTR lpCmdLine, int nCmdShow);
  3983. void AFXAPI AfxWinTerm();
  3984.  
  3985. // Global Windows state data helper functions (inlines)
  3986. CWinApp* AFXAPI AfxGetApp();
  3987. CWnd* AFXAPI AfxGetMainWnd();
  3988. HINSTANCE AFXAPI AfxGetInstanceHandle();
  3989. HINSTANCE AFXAPI AfxGetResourceHandle();
  3990. void AFXAPI AfxSetResourceHandle(HINSTANCE hInstResource);
  3991. LPCTSTR AFXAPI AfxGetAppName();
  3992.  
  3993. // Use instead of PostQuitMessage in OLE server applications
  3994. void AFXAPI AfxPostQuitMessage(int nExitCode);
  3995.  
  3996. // Use AfxFindResourceHandle to find resource in chain of extension DLLs
  3997. #ifndef _AFXDLL
  3998. #define AfxFindResourceHandle(lpszResource, lpszType) AfxGetResourceHandle()
  3999. #else
  4000. HINSTANCE AFXAPI AfxFindResourceHandle(LPCTSTR lpszName, LPCTSTR lpszType);
  4001. #endif
  4002.  
  4003. LONG AFXAPI AfxDelRegTreeHelper(HKEY hParentKey, const CString& strKeyName);
  4004.  
  4005. class CRecentFileList;          // forward reference (see afxpriv.h)
  4006.  
  4007. // access to message filter in CWinApp
  4008. #if !defined(_WIN32_WCE)
  4009. COleMessageFilter* AFXAPI AfxOleGetMessageFilter();
  4010. #endif // _WIN32_WCE
  4011.  
  4012. /////////////////////////////////////////////////////////////////////////////
  4013. // CCommandLineInfo
  4014.  
  4015. class CCommandLineInfo : public CObject
  4016. {
  4017. public:
  4018.     // Sets default values
  4019.     CCommandLineInfo();
  4020.  
  4021.     //plain char* version on UNICODE for source-code backwards compatibility
  4022.     virtual void ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast);
  4023. #ifdef _UNICODE
  4024.     virtual void ParseParam(const char* pszParam, BOOL bFlag, BOOL bLast);
  4025. #endif
  4026.  
  4027.     BOOL m_bShowSplash;
  4028. #if !defined(_WIN32_WCE_NO_OLE)
  4029.     BOOL m_bRunEmbedded;
  4030.     BOOL m_bRunAutomated;
  4031. #endif // _WIN32_WCE_NO_OLE
  4032.     enum { FileNew, FileOpen, FilePrint, FilePrintTo, FileDDE,
  4033.         AppUnregister, FileNothing = -1 } m_nShellCommand;
  4034.  
  4035.     // not valid for FileNew
  4036.     CString m_strFileName;
  4037.  
  4038.     // valid only for FilePrintTo
  4039. WCE_DEL CString m_strPrinterName;
  4040. WCE_DEL CString m_strDriverName;
  4041. WCE_DEL CString m_strPortName;
  4042.  
  4043.     ~CCommandLineInfo();
  4044. // Implementation
  4045. protected:
  4046.     void ParseParamFlag(const char* pszParam);
  4047.     void ParseParamNotFlag(const TCHAR* pszParam);
  4048. #ifdef _UNICODE
  4049.     void ParseParamNotFlag(const char* pszParam);
  4050. #endif
  4051.     void ParseLast(BOOL bLast);
  4052. };
  4053.  
  4054. /////////////////////////////////////////////////////////////////////////////
  4055. // CDocManager
  4056.  
  4057. class CDocManager : public CObject
  4058. {
  4059.     DECLARE_DYNAMIC(CDocManager)
  4060. public:
  4061.  
  4062. // Constructor
  4063.     CDocManager();
  4064.  
  4065.     //Document functions
  4066.     virtual void AddDocTemplate(CDocTemplate* pTemplate);
  4067.     virtual POSITION GetFirstDocTemplatePosition() const;
  4068.     virtual CDocTemplate* GetNextDocTemplate(POSITION& pos) const;
  4069. WCE_DEL    virtual void RegisterShellFileTypes(BOOL bCompat);
  4070. WCE_DEL    void UnregisterShellFileTypes();
  4071.     virtual CDocument* OpenDocumentFile(LPCTSTR lpszFileName); // open named file
  4072.     virtual BOOL SaveAllModified(); // save before exit
  4073.     virtual void CloseAllDocuments(BOOL bEndSession); // close documents before exiting
  4074.     virtual int GetOpenDocumentCount();
  4075.  
  4076.     // helper for standard commdlg dialogs
  4077.     virtual BOOL DoPromptFileName(CString& fileName, UINT nIDSTitle,
  4078.             DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate);
  4079.  
  4080. //Commands
  4081.     // Advanced: process async DDE request
  4082.     virtual BOOL OnDDECommand(LPTSTR lpszCommand);
  4083.     virtual void OnFileNew();
  4084.     virtual void OnFileOpen();
  4085.  
  4086. // Implementation
  4087. protected:
  4088.     CPtrList m_templateList;
  4089.     int GetDocumentCount();    // helper to count number of total documents
  4090.  
  4091. public:
  4092.     static CPtrList* pStaticList;       // for static CDocTemplate objects
  4093.     static BOOL bStaticInit;            // TRUE during static initialization
  4094.     static CDocManager* pStaticDocManager;  // for static CDocTemplate objects
  4095.  
  4096. public:
  4097.     virtual ~CDocManager();
  4098. #ifdef _DEBUG
  4099.     virtual void AssertValid() const;
  4100.     virtual void Dump(CDumpContext& dc) const;
  4101. #endif
  4102. };
  4103.  
  4104. /////////////////////////////////////////////////////////////////////////////
  4105. // CWinApp - the root of all Windows applications
  4106.  
  4107. #define _AFX_MRU_COUNT   4      // default support for 4 entries in file MRU
  4108. #define _AFX_MRU_MAX_COUNT 16   // currently allocated id range supports 16
  4109.  
  4110. class CWinApp : public CWinThread
  4111. {
  4112.     DECLARE_DYNAMIC(CWinApp)
  4113. public:
  4114.  
  4115. // Constructor
  4116.     CWinApp(LPCTSTR lpszAppName = NULL);     // app name defaults to EXE name
  4117.  
  4118. // Attributes
  4119.     // Startup args (do not change)
  4120.     HINSTANCE m_hInstance;
  4121.     HINSTANCE m_hPrevInstance;
  4122.     LPTSTR m_lpCmdLine;
  4123.     int m_nCmdShow;
  4124.  
  4125.     // Running args (can be changed in InitInstance)
  4126.     LPCTSTR m_pszAppName;  // human readable name
  4127.                                 //  (from constructor or AFX_IDS_APP_TITLE)
  4128.     LPCTSTR m_pszRegistryKey;   // used for registry entries
  4129.     CDocManager* m_pDocManager;
  4130.  
  4131.     // Support for Shift+F1 help mode.
  4132.     BOOL m_bHelpMode;           // are we in Shift+F1 mode?
  4133.  
  4134. public:  // set in constructor to override default
  4135.     LPCTSTR m_pszExeName;       // executable name (no spaces)
  4136.     LPCTSTR m_pszHelpFilePath;  // default based on module path
  4137.     LPCTSTR m_pszProfileName;   // default based on app name
  4138.  
  4139. // Initialization Operations - should be done in InitInstance
  4140. protected:
  4141.     void LoadStdProfileSettings(UINT nMaxMRU = _AFX_MRU_COUNT); // load MRU file list and last preview state
  4142. WCE_DEL    void EnableShellOpen();
  4143.  
  4144. #ifndef _AFX_NO_GRAYDLG_SUPPORT
  4145.     void SetDialogBkColor(COLORREF clrCtlBk = RGB(192, 192, 192),
  4146.                 COLORREF clrCtlText = RGB(0, 0, 0));
  4147.         // set dialog box and message box background color
  4148. #endif
  4149.  
  4150.     void SetRegistryKey(LPCTSTR lpszRegistryKey);
  4151.     void SetRegistryKey(UINT nIDRegistryKey);
  4152.         // enables app settings in registry instead of INI files
  4153.         //  (registry key is usually a "company name")
  4154.  
  4155. #ifndef _AFX_NO_CTL3D_SUPPORT
  4156. WCE_DEL    BOOL Enable3dControls(); // use CTL3D32.DLL for 3D controls in dialogs
  4157. #ifndef _AFXDLL
  4158. WCE_DEL    BOOL Enable3dControlsStatic();  // statically link CTL3D.LIB instead
  4159. #endif
  4160. #endif
  4161.  
  4162. WCE_DEL    void RegisterShellFileTypes(BOOL bCompat=FALSE);
  4163.         // call after all doc templates are registered
  4164. WCE_DEL    void RegisterShellFileTypesCompat();
  4165.         // for backwards compatibility
  4166. WCE_DEL    void UnregisterShellFileTypes();
  4167.  
  4168. // Helper Operations - usually done in InitInstance
  4169. public:
  4170.     // Cursors
  4171. #if !defined(_WIN32_WCE_NO_CURSOR)
  4172.     HCURSOR LoadCursor(LPCTSTR lpszResourceName) const;
  4173.     HCURSOR LoadCursor(UINT nIDResource) const;
  4174.     HCURSOR LoadStandardCursor(LPCTSTR lpszCursorName) const; // for IDC_ values
  4175. #endif // _WIN32_WCE_NO_CURSOR
  4176. WCE_DEL    HCURSOR LoadOEMCursor(UINT nIDCursor) const;             // for OCR_ values
  4177.  
  4178.     // Icons
  4179.     HICON LoadIcon(LPCTSTR lpszResourceName) const;
  4180.     HICON LoadIcon(UINT nIDResource) const;
  4181.     HICON LoadStandardIcon(LPCTSTR lpszIconName) const;       // for IDI_ values
  4182.     HICON LoadOEMIcon(UINT nIDIcon) const;                   // for OIC_ values
  4183.  
  4184.     // Profile settings (to the app specific .INI file, or registry)
  4185.     UINT GetProfileInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, int nDefault);
  4186.     BOOL WriteProfileInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, int nValue);
  4187.     CString GetProfileString(LPCTSTR lpszSection, LPCTSTR lpszEntry,
  4188.                 LPCTSTR lpszDefault = NULL);
  4189.     BOOL WriteProfileString(LPCTSTR lpszSection, LPCTSTR lpszEntry,
  4190.                 LPCTSTR lpszValue);
  4191.     BOOL GetProfileBinary(LPCTSTR lpszSection, LPCTSTR lpszEntry,
  4192.                 LPBYTE* ppData, UINT* pBytes);
  4193.     BOOL WriteProfileBinary(LPCTSTR lpszSection, LPCTSTR lpszEntry,
  4194.                 LPBYTE pData, UINT nBytes);
  4195.  
  4196.     BOOL Unregister();
  4197.     LONG DelRegTree(HKEY hParentKey, const CString& strKeyName);
  4198.  
  4199. // Running Operations - to be done on a running application
  4200.     // Dealing with document templates
  4201.     void AddDocTemplate(CDocTemplate* pTemplate);
  4202.     POSITION GetFirstDocTemplatePosition() const;
  4203.     CDocTemplate* GetNextDocTemplate(POSITION& pos) const;
  4204.  
  4205.     // Dealing with files
  4206.     virtual CDocument* OpenDocumentFile(LPCTSTR lpszFileName); // open named file
  4207.     virtual void AddToRecentFileList(LPCTSTR lpszPathName);  // add to MRU
  4208.  
  4209. #if !defined(_WIN32_WCE_NO_PRINTING)
  4210.     // Printer DC Setup routine, 'struct tagPD' is a PRINTDLG structure
  4211. WCE_DEL    void SelectPrinter(HANDLE hDevNames, HANDLE hDevMode, 
  4212. WCE_DEL        BOOL bFreeOld = TRUE);
  4213. WCE_DEL    BOOL CreatePrinterDC(CDC& dc); // WinCE: we depend on return hDC from PRINTDLG
  4214. #ifndef _UNICODE
  4215.     BOOL GetPrinterDeviceDefaults(struct tagPDA* pPrintDlg);
  4216. #else
  4217. WCE_DEL    BOOL GetPrinterDeviceDefaults(struct tagPDW* pPrintDlg);
  4218. #endif
  4219. #endif // _WIN32_WCE_NO_PRINTING
  4220.  
  4221.     // Command line parsing
  4222. #if !defined(_WIN32_WCE_NO_OLE)
  4223.     BOOL RunEmbedded();
  4224.     BOOL RunAutomated();
  4225. #endif // _WIN32_WCE_NO_OLE
  4226.     void ParseCommandLine(CCommandLineInfo& rCmdInfo);
  4227.     BOOL ProcessShellCommand(CCommandLineInfo& rCmdInfo);
  4228.  
  4229. // Overridables
  4230.     // hooks for your initialization code
  4231.     virtual BOOL InitApplication();
  4232.  
  4233.     // exiting
  4234.     virtual BOOL SaveAllModified(); // save before exit
  4235.     void HideApplication();
  4236.     void CloseAllDocuments(BOOL bEndSession); // close documents before exiting
  4237.  
  4238.     // Advanced: to override message boxes and other hooks
  4239.     virtual int DoMessageBox(LPCTSTR lpszPrompt, UINT nType, UINT nIDPrompt);
  4240.     virtual void DoWaitCursor(int nCode); // 0 => restore, 1=> begin, -1=> end
  4241.  
  4242.     // Advanced: process async DDE request
  4243.     virtual BOOL OnDDECommand(LPTSTR lpszCommand);
  4244.  
  4245.     // Advanced: Help support
  4246.     virtual void WinHelp(DWORD dwData, UINT nCmd = WCE_IF(0,HELP_HELPFILE));
  4247.  
  4248. // Command Handlers
  4249. protected:
  4250.     // map to the following for file new/open
  4251.     afx_msg void OnFileNew();
  4252.     afx_msg void OnFileOpen();
  4253.  
  4254.     // map to the following to enable print setup
  4255. WCE_DEL    afx_msg void OnFilePrintSetup();
  4256.  
  4257.     // map to the following to enable help
  4258. WCE_DEL    afx_msg void OnContextHelp();   // shift-F1
  4259.     afx_msg void OnHelp();          // F1 (uses current context)
  4260. WCE_DEL    afx_msg void OnHelpIndex();     // ID_HELP_INDEX
  4261. WCE_DEL    afx_msg void OnHelpFinder();    // ID_HELP_FINDER, ID_DEFAULT_HELP
  4262. WCE_DEL    afx_msg void OnHelpUsing();     // ID_HELP_USING
  4263.  
  4264. // Implementation
  4265. protected:
  4266. #if defined(_WIN32_WCE)
  4267. // WinCE: We store the hDC returned by the dialog in place of DevMode and DevNames.
  4268.     HDC m_hdc;                      // printer hDC (returned by WCE's PrintDlg)
  4269. #else // _WIN32_WCE
  4270.     HGLOBAL m_hDevMode;             // printer Dev Mode
  4271.     HGLOBAL m_hDevNames;            // printer Device Names
  4272. #endif // _WIN32_WCE
  4273.     DWORD m_dwPromptContext;        // help context override for message box
  4274.  
  4275.     int m_nWaitCursorCount;         // for wait cursor (>0 => waiting)
  4276.     HCURSOR m_hcurWaitCursorRestore; // old cursor to restore after wait cursor
  4277.  
  4278.     CRecentFileList* m_pRecentFileList;
  4279.  
  4280. WCE_DEL void UpdatePrinterSelection(BOOL bForceDefaults);
  4281.     void SaveStdProfileSettings();  // save options to .INI file
  4282.  
  4283. public: // public for implementation access
  4284.     CCommandLineInfo* m_pCmdInfo;
  4285.  
  4286.     ATOM m_atomApp, m_atomSystemTopic;   // for DDE open
  4287. WCE_DEL UINT m_nNumPreviewPages;        // number of default printed pages
  4288.  
  4289.     size_t  m_nSafetyPoolSize;      // ideal size
  4290.  
  4291. WCE_DEL    void (AFXAPI* m_lpfnDaoTerm)();
  4292.  
  4293. WCE_DEL    void DevModeChange(LPTSTR lpDeviceName);
  4294.     void SetCurrentHandles();
  4295.     int GetOpenDocumentCount();
  4296.  
  4297.     // helpers for standard commdlg dialogs
  4298.     BOOL DoPromptFileName(CString& fileName, UINT nIDSTitle,
  4299.             DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate);
  4300. #if !defined(_WIN32_WCE_NO_PRINTING)
  4301.     int DoPrintDialog(CPrintDialog* pPD);
  4302. #endif // _WIN32_WCE_NO_PRINTING
  4303.  
  4304.     void EnableModeless(BOOL bEnable); // to disable OLE in-place dialogs
  4305.  
  4306.     // overrides for implementation
  4307.     virtual BOOL InitInstance();
  4308.     virtual int ExitInstance(); // return app exit code
  4309.     virtual int Run();
  4310.     virtual BOOL OnIdle(LONG lCount); // return TRUE if more idle processing
  4311.     virtual LRESULT ProcessWndProcException(CException* e, const MSG* pMsg);
  4312.  
  4313. public:
  4314.     virtual ~CWinApp();
  4315. #ifdef _DEBUG
  4316.     virtual void AssertValid() const;
  4317.     virtual void Dump(CDumpContext& dc) const;
  4318. #endif
  4319.  
  4320.     // helpers for registration
  4321.     HKEY GetSectionKey(LPCTSTR lpszSection);
  4322.     HKEY GetAppRegistryKey();
  4323.  
  4324. protected:
  4325.     //{{AFX_MSG(CWinApp)
  4326.     afx_msg void OnAppExit();
  4327.     afx_msg void OnUpdateRecentFileMenu(CCmdUI* pCmdUI);
  4328.     afx_msg BOOL OnOpenRecentFile(UINT nID);
  4329.     //}}AFX_MSG
  4330.     DECLARE_MESSAGE_MAP()
  4331. };
  4332.  
  4333. /////////////////////////////////////////////////////////////////////////////
  4334. // class CWaitCursor
  4335.  
  4336. class CWaitCursor
  4337. {
  4338. // Construction/Destruction
  4339. public:
  4340.     CWaitCursor();
  4341.     ~CWaitCursor();
  4342.  
  4343. // Operations
  4344. public:
  4345.     void Restore();
  4346. };
  4347.  
  4348. /////////////////////////////////////////////////////////////////////////////
  4349. // class CDocTemplate creates documents
  4350.  
  4351. #ifdef _AFXDLL
  4352. class CDocTemplate : public CCmdTarget
  4353. #else
  4354. class AFX_NOVTABLE CDocTemplate : public CCmdTarget
  4355. #endif
  4356. {
  4357.     DECLARE_DYNAMIC(CDocTemplate)
  4358.  
  4359. // Constructors
  4360. protected:
  4361.     CDocTemplate(UINT nIDResource, CRuntimeClass* pDocClass,
  4362.         CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass);
  4363.  
  4364. public:
  4365.     virtual void LoadTemplate();
  4366.  
  4367. // Attributes
  4368. public:
  4369. #if !defined(_WIN32_WCE_NO_OLE)
  4370.     // setup for OLE containers
  4371.     void SetContainerInfo(UINT nIDOleInPlaceContainer);
  4372.  
  4373.     // setup for OLE servers
  4374.     void SetServerInfo(UINT nIDOleEmbedding, UINT nIDOleInPlaceServer = 0,
  4375.         CRuntimeClass* pOleFrameClass = NULL, CRuntimeClass* pOleViewClass = NULL);
  4376. #endif // _WIN32_WCE_NO_OLE
  4377.  
  4378.     // iterating over open documents
  4379.     virtual POSITION GetFirstDocPosition() const = 0;
  4380.     virtual CDocument* GetNextDoc(POSITION& rPos) const = 0;
  4381.  
  4382. // Operations
  4383. public:
  4384.     virtual void AddDocument(CDocument* pDoc);      // must override
  4385.     virtual void RemoveDocument(CDocument* pDoc);   // must override
  4386.  
  4387.     enum DocStringIndex
  4388.     {
  4389.         windowTitle,        // default window title
  4390.         docName,            // user visible name for default document
  4391.         fileNewName,        // user visible name for FileNew
  4392.         // for file based documents:
  4393.         filterName,         // user visible name for FileOpen
  4394.         filterExt,          // user visible extension for FileOpen
  4395.         // for file based documents with Shell open support:
  4396.         regFileTypeId,      // REGEDIT visible registered file type identifier
  4397.         regFileTypeName,    // Shell visible registered file type name
  4398.     };
  4399.     virtual BOOL GetDocString(CString& rString,
  4400.         enum DocStringIndex index) const; // get one of the info strings
  4401. #if !defined(_WIN32_WCE_NO_OLE)
  4402.     CFrameWnd* CreateOleFrame(CWnd* pParentWnd, CDocument* pDoc,
  4403.         BOOL bCreateView);
  4404. #endif // _WIN32_WCE_NO_OLE
  4405.  
  4406. // Overridables
  4407. public:
  4408.     enum Confidence
  4409.     {
  4410.         noAttempt,
  4411.         maybeAttemptForeign,
  4412.         maybeAttemptNative,
  4413.         yesAttemptForeign,
  4414.         yesAttemptNative,
  4415.         yesAlreadyOpen
  4416.     };
  4417.     virtual Confidence MatchDocType(LPCTSTR lpszPathName,
  4418.                     CDocument*& rpDocMatch);
  4419.     virtual CDocument* CreateNewDocument();
  4420.     virtual CFrameWnd* CreateNewFrame(CDocument* pDoc, CFrameWnd* pOther);
  4421.     virtual void InitialUpdateFrame(CFrameWnd* pFrame, CDocument* pDoc,
  4422.         BOOL bMakeVisible = TRUE);
  4423.     virtual BOOL SaveAllModified();     // for all documents
  4424.     virtual void CloseAllDocuments(BOOL bEndSession);
  4425.     virtual CDocument* OpenDocumentFile(
  4426.         LPCTSTR lpszPathName, BOOL bMakeVisible = TRUE) = 0;
  4427.                     // open named file
  4428.                     // if lpszPathName == NULL => create new file with this type
  4429.     virtual void SetDefaultTitle(CDocument* pDocument) = 0;
  4430.  
  4431. // Implementation
  4432. public:
  4433.     BOOL m_bAutoDelete;
  4434.     virtual ~CDocTemplate();
  4435.  
  4436. #if !defined(_WIN32_WCE_NO_OLE)
  4437.     // back pointer to OLE or other server (NULL if none or disabled)
  4438.     CObject* m_pAttachedFactory;
  4439. #endif // _WIN32_WCE_NO_OLE
  4440.  
  4441.     // menu & accelerator resources for in-place container
  4442.     HMENU m_hMenuInPlace;
  4443.     HACCEL m_hAccelInPlace;
  4444.  
  4445.     // menu & accelerator resource for server editing embedding
  4446.     HMENU m_hMenuEmbedding;
  4447.     HACCEL m_hAccelEmbedding;
  4448.  
  4449.     // menu & accelerator resource for server editing in-place
  4450.     HMENU m_hMenuInPlaceServer;
  4451.     HACCEL m_hAccelInPlaceServer;
  4452.  
  4453. #ifdef _DEBUG
  4454.     virtual void Dump(CDumpContext&) const;
  4455.     virtual void AssertValid() const;
  4456. #endif
  4457.     virtual void OnIdle();             // for all documents
  4458.     virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,
  4459.         AFX_CMDHANDLERINFO* pHandlerInfo);
  4460.  
  4461. protected:
  4462.     UINT m_nIDResource;                 // IDR_ for frame/menu/accel as well
  4463.     UINT m_nIDServerResource;           // IDR_ for OLE inplace frame/menu/accel
  4464.     UINT m_nIDEmbeddingResource;        // IDR_ for OLE open frame/menu/accel
  4465.     UINT m_nIDContainerResource;        // IDR_ for container frame/menu/accel
  4466.  
  4467.     CRuntimeClass* m_pDocClass;         // class for creating new documents
  4468.     CRuntimeClass* m_pFrameClass;       // class for creating new frames
  4469.     CRuntimeClass* m_pViewClass;        // class for creating new views
  4470.     CRuntimeClass* m_pOleFrameClass;    // class for creating in-place frame
  4471.     CRuntimeClass* m_pOleViewClass;     // class for creating in-place view
  4472.  
  4473.     CString m_strDocStrings;    // '\n' separated names
  4474.         // The document names sub-strings are represented as _one_ string:
  4475.         // windowTitle\ndocName\n ... (see DocStringIndex enum)
  4476. };
  4477.  
  4478. // SDI support (1 document only)
  4479. class CSingleDocTemplate : public CDocTemplate
  4480. {
  4481.     DECLARE_DYNAMIC(CSingleDocTemplate)
  4482.  
  4483. // Constructors
  4484. public:
  4485.     CSingleDocTemplate(UINT nIDResource, CRuntimeClass* pDocClass,
  4486.         CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass);
  4487.  
  4488. // Implementation
  4489. public:
  4490.     virtual ~CSingleDocTemplate();
  4491.     virtual void AddDocument(CDocument* pDoc);
  4492.     virtual void RemoveDocument(CDocument* pDoc);
  4493.     virtual POSITION GetFirstDocPosition() const;
  4494.     virtual CDocument* GetNextDoc(POSITION& rPos) const;
  4495.     virtual CDocument* OpenDocumentFile(
  4496.         LPCTSTR lpszPathName, BOOL bMakeVisible = TRUE);
  4497.     virtual void SetDefaultTitle(CDocument* pDocument);
  4498.  
  4499. #ifdef _DEBUG
  4500.     virtual void Dump(CDumpContext&) const;
  4501.     virtual void AssertValid() const;
  4502. #endif //_DEBUG
  4503.  
  4504. protected:  // standard implementation
  4505.     CDocument* m_pOnlyDoc;
  4506. };
  4507.  
  4508. #if !defined(_WIN32_WCE)
  4509. // MDI support (zero or more documents)
  4510. class CMultiDocTemplate : public CDocTemplate
  4511. {
  4512.     DECLARE_DYNAMIC(CMultiDocTemplate)
  4513.  
  4514. // Constructors
  4515. public:
  4516.     CMultiDocTemplate(UINT nIDResource, CRuntimeClass* pDocClass,
  4517.         CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass);
  4518.  
  4519. // Implementation
  4520. public:
  4521.     // Menu and accel table for MDI Child windows of this type
  4522.     HMENU m_hMenuShared;
  4523.     HACCEL m_hAccelTable;
  4524.  
  4525.     virtual ~CMultiDocTemplate();
  4526.     virtual void LoadTemplate();
  4527.     virtual void AddDocument(CDocument* pDoc);
  4528.     virtual void RemoveDocument(CDocument* pDoc);
  4529.     virtual POSITION GetFirstDocPosition() const;
  4530.     virtual CDocument* GetNextDoc(POSITION& rPos) const;
  4531.     virtual CDocument* OpenDocumentFile(
  4532.         LPCTSTR lpszPathName, BOOL bMakeVisible = TRUE);
  4533.     virtual void SetDefaultTitle(CDocument* pDocument);
  4534.  
  4535. #ifdef _DEBUG
  4536.     virtual void Dump(CDumpContext&) const;
  4537.     virtual void AssertValid() const;
  4538. #endif //_DEBUG
  4539.  
  4540. protected:  // standard implementation
  4541.     CPtrList m_docList;          // open documents of this type
  4542.     UINT m_nUntitledCount;   // start at 0, for "Document1" title
  4543. };
  4544. #endif // _WIN32_WCE
  4545.  
  4546. /////////////////////////////////////////////////////////////////////////////
  4547. // class CDocument is the main document data abstraction
  4548.  
  4549. #ifdef _AFXDLL
  4550. class CDocument : public CCmdTarget
  4551. #else
  4552. class AFX_NOVTABLE CDocument : public CCmdTarget
  4553. #endif
  4554. {
  4555.     DECLARE_DYNAMIC(CDocument)
  4556.  
  4557. public:
  4558. // Constructors
  4559.     CDocument();
  4560.  
  4561. // Attributes
  4562. public:
  4563.     const CString& GetTitle() const;
  4564.     virtual void SetTitle(LPCTSTR lpszTitle);
  4565.     const CString& GetPathName() const;
  4566.     virtual void SetPathName(LPCTSTR lpszPathName, BOOL bAddToMRU = TRUE);
  4567.  
  4568.     CDocTemplate* GetDocTemplate() const;
  4569.     virtual BOOL IsModified();
  4570.     virtual void SetModifiedFlag(BOOL bModified = TRUE);
  4571.  
  4572. // Operations
  4573.     void AddView(CView* pView);
  4574.     void RemoveView(CView* pView);
  4575.     virtual POSITION GetFirstViewPosition() const;
  4576.     virtual CView* GetNextView(POSITION& rPosition) const;
  4577.  
  4578.     // Update Views (simple update - DAG only)
  4579.     void UpdateAllViews(CView* pSender, LPARAM lHint = 0L,
  4580.         CObject* pHint = NULL);
  4581.  
  4582. // Overridables
  4583.     // Special notifications
  4584.     virtual void OnChangedViewList(); // after Add or Remove view
  4585.     virtual void DeleteContents(); // delete doc items etc
  4586.  
  4587.     // File helpers
  4588.     virtual BOOL OnNewDocument();
  4589.     virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
  4590.     virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
  4591.     virtual void OnCloseDocument();
  4592.     virtual void ReportSaveLoadException(LPCTSTR lpszPathName,
  4593.                 CException* e, BOOL bSaving, UINT nIDPDefault);
  4594.     virtual CFile* GetFile(LPCTSTR lpszFileName, UINT nOpenFlags,
  4595.         CFileException* pError);
  4596.     virtual void ReleaseFile(CFile* pFile, BOOL bAbort);
  4597.  
  4598.     // advanced overridables, closing down frame/doc, etc.
  4599.     virtual BOOL CanCloseFrame(CFrameWnd* pFrame);
  4600.     virtual BOOL SaveModified(); // return TRUE if ok to continue
  4601.     virtual void PreCloseFrame(CFrameWnd* pFrame);
  4602.  
  4603. // Implementation
  4604. protected:
  4605.     // default implementation
  4606.     CString m_strTitle;
  4607.     CString m_strPathName;
  4608.     CDocTemplate* m_pDocTemplate;
  4609.     CPtrList m_viewList;                // list of views
  4610.     BOOL m_bModified;                   // changed since last saved
  4611.  
  4612. public:
  4613.     BOOL m_bAutoDelete;     // TRUE => delete document when no more views
  4614.     BOOL m_bEmbedded;       // TRUE => document is being created by OLE
  4615.  
  4616. #ifdef _DEBUG
  4617.     virtual void Dump(CDumpContext&) const;
  4618.     virtual void AssertValid() const;
  4619. #endif //_DEBUG
  4620.     virtual ~CDocument();
  4621.  
  4622.     // implementation helpers
  4623.     virtual BOOL DoSave(LPCTSTR lpszPathName, BOOL bReplace = TRUE);
  4624.     virtual BOOL DoFileSave();
  4625.     virtual void UpdateFrameCounts();
  4626.     void DisconnectViews();
  4627.     void SendInitialUpdate();
  4628.  
  4629.     // overridables for implementation
  4630.     virtual HMENU GetDefaultMenu(); // get menu depending on state
  4631.     virtual HACCEL GetDefaultAccelerator();
  4632.     virtual void OnIdle();
  4633.     virtual void OnFinalRelease();
  4634.  
  4635.     virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,
  4636.         AFX_CMDHANDLERINFO* pHandlerInfo);
  4637.     friend class CDocTemplate;
  4638.  
  4639. protected:
  4640.     // file menu commands
  4641.     //{{AFX_MSG(CDocument)
  4642.     afx_msg void OnFileClose();
  4643.     afx_msg void OnFileSave();
  4644.     afx_msg void OnFileSaveAs();
  4645.     //}}AFX_MSG
  4646.     // mail enabling
  4647. WCE_DEL    afx_msg void OnFileSendMail();
  4648. WCE_DEL    afx_msg void OnUpdateFileSendMail(CCmdUI* pCmdUI);
  4649.     DECLARE_MESSAGE_MAP()
  4650. };
  4651.  
  4652. /////////////////////////////////////////////////////////////////////////////
  4653. // Extra diagnostic tracing options
  4654.  
  4655. #ifdef _DEBUG
  4656.  
  4657. extern AFX_DATA UINT afxTraceFlags;
  4658. enum AfxTraceFlags
  4659. {
  4660.     traceMultiApp = 1,      // multi-app debugging
  4661.     traceAppMsg = 2,        // main message pump trace (includes DDE)
  4662.     traceWinMsg = 4,        // Windows message tracing
  4663.     traceCmdRouting = 8,    // Windows command routing trace (set 4+8 for control notifications)
  4664.     traceOle = 16,          // special OLE callback trace
  4665.     traceDatabase = 32,     // special database trace
  4666.     traceInternet = 64      // special Internet client trace
  4667. };
  4668.  
  4669. #endif // _DEBUG
  4670.  
  4671. //////////////////////////////////////////////////////////////////////////////
  4672. // MessageBox helpers
  4673.  
  4674. void AFXAPI AfxFormatString1(CString& rString, UINT nIDS, LPCTSTR lpsz1);
  4675. void AFXAPI AfxFormatString2(CString& rString, UINT nIDS,
  4676.                 LPCTSTR lpsz1, LPCTSTR lpsz2);
  4677. #if defined(_WIN32_WCE)
  4678. // WinCE: message boxes sometimes are not brought to the front
  4679. int AFXAPI AfxMessageBox(LPCTSTR lpszText, UINT nType = MB_OK,
  4680.                 UINT nIDHelp = 0);
  4681. int AFXAPI AfxMessageBox(UINT nIDPrompt, UINT nType = MB_OK,
  4682.                 UINT nIDHelp = (UINT)-1);
  4683. #else // _WIN32_WCE
  4684. int AFXAPI AfxMessageBox(LPCTSTR lpszText, UINT nType = MB_OK,
  4685.                 UINT nIDHelp = 0);
  4686. int AFXAPI AfxMessageBox(UINT nIDPrompt, UINT nType = MB_OK,
  4687.                 UINT nIDHelp = (UINT)-1);
  4688. #endif // _WIN32_WCE
  4689.  
  4690. // Implementation string helpers
  4691. void AFXAPI AfxFormatStrings(CString& rString, UINT nIDS,
  4692.                 LPCTSTR const* rglpsz, int nString);
  4693. void AFXAPI AfxFormatStrings(CString& rString, LPCTSTR lpszFormat,
  4694.                 LPCTSTR const* rglpsz, int nString);
  4695. BOOL AFXAPI AfxExtractSubString(CString& rString, LPCTSTR lpszFullString,
  4696.                 int iSubString, TCHAR chSep = '\n');
  4697.  
  4698. /////////////////////////////////////////////////////////////////////////////
  4699. // Special target variant APIs
  4700.  
  4701. #ifdef _AFXDLL
  4702.     #include <afxdll_.h>
  4703. #endif
  4704.  
  4705. // Windows Version compatibility (obsolete)
  4706. #define AfxEnableWin30Compatibility()
  4707. #define AfxEnableWin31Compatibility()
  4708. #define AfxEnableWin40Compatibility()
  4709.  
  4710. // Temporary map management (locks temp map on current thread)
  4711. void AFXAPI AfxLockTempMaps();
  4712. BOOL AFXAPI AfxUnlockTempMaps(BOOL bDeleteTemps = TRUE);
  4713.  
  4714. #if !defined(_WIN32_WCE_NO_OLE)
  4715. /////////////////////////////////////////////////////////////////////////////
  4716. // Special OLE related functions (see OLELOCK.CPP)
  4717.  
  4718. void AFXAPI AfxOleOnReleaseAllObjects();
  4719. BOOL AFXAPI AfxOleCanExitApp();
  4720. void AFXAPI AfxOleLockApp();
  4721. void AFXAPI AfxOleUnlockApp();
  4722.  
  4723. void AFXAPI AfxOleSetUserCtrl(BOOL bUserCtrl);
  4724. BOOL AFXAPI AfxOleGetUserCtrl();
  4725.  
  4726. #ifndef _AFX_NO_OCC_SUPPORT
  4727. BOOL AFXAPI AfxOleLockControl(REFCLSID clsid);
  4728. BOOL AFXAPI AfxOleUnlockControl(REFCLSID clsid);
  4729. BOOL AFXAPI AfxOleLockControl(LPCTSTR lpszProgID);
  4730. BOOL AFXAPI AfxOleUnlockControl(LPCTSTR lpszProgID);
  4731. void AFXAPI AfxOleUnlockAllControls();
  4732. #endif
  4733. #endif // _WIN32_WCE_NO_OLE
  4734.  
  4735. /////////////////////////////////////////////////////////////////////////////
  4736. // Use version 1.0 of the RichEdit control
  4737.  
  4738. #define _RICHEDIT_VER 0x0100
  4739.  
  4740. /////////////////////////////////////////////////////////////////////////////
  4741. // Inline function declarations
  4742.  
  4743. #ifdef _AFX_PACKING
  4744. #pragma pack(pop)
  4745. #endif
  4746.  
  4747. #ifdef _AFX_ENABLE_INLINES
  4748. #define _AFXWIN_INLINE AFX_INLINE
  4749. #include <afxwin1.inl>
  4750. #include <afxwin2.inl>
  4751. #endif
  4752.  
  4753. #undef AFX_DATA
  4754. #define AFX_DATA
  4755.  
  4756. #ifdef _AFX_MINREBUILD
  4757. #pragma component(minrebuild, on)
  4758. #endif
  4759. #ifndef _AFX_FULLTYPEINFO
  4760. #pragma component(mintypeinfo, off)
  4761. #endif
  4762.  
  4763. /////////////////////////////////////////////////////////////////////////////
  4764.  
  4765. #else //RC_INVOKED
  4766. #include <afxres.h>     // standard resource IDs
  4767. #endif //RC_INVOKED
  4768.  
  4769. #endif //__AFXWIN_H__
  4770.  
  4771. /////////////////////////////////////////////////////////////////////////////
  4772.